summaryrefslogtreecommitdiff
path: root/chromium/ui/gfx/font_render_params.cc
blob: 31799c8674f6a0eb93e93c8e2c3da7464c4c31a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/gfx/font_render_params.h"

#include "base/notreached.h"

namespace gfx {

// static
SkPixelGeometry FontRenderParams::SubpixelRenderingToSkiaPixelGeometry(
    FontRenderParams::SubpixelRendering subpixel_rendering) {
  switch (subpixel_rendering) {
    case gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE:
      return kRGB_H_SkPixelGeometry;  // why not kUnknown_SkPixelGeometry ??
    case gfx::FontRenderParams::SUBPIXEL_RENDERING_RGB:
      return kRGB_H_SkPixelGeometry;
    case gfx::FontRenderParams::SUBPIXEL_RENDERING_VRGB:
      return kRGB_V_SkPixelGeometry;
    case gfx::FontRenderParams::SUBPIXEL_RENDERING_BGR:
      return kBGR_H_SkPixelGeometry;
    case gfx::FontRenderParams::SUBPIXEL_RENDERING_VBGR:
      return kBGR_V_SkPixelGeometry;
  }

  NOTREACHED();
  return kRGB_H_SkPixelGeometry;
}

FontRenderParamsQuery::FontRenderParamsQuery()
    : pixel_size(0),
      point_size(0),
      style(-1),
      weight(Font::Weight::INVALID),
      device_scale_factor(0) {}

FontRenderParamsQuery::FontRenderParamsQuery(
    const FontRenderParamsQuery& other) = default;

FontRenderParamsQuery::~FontRenderParamsQuery() {}

}  // namespace gfx