Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: ui/gfx/harfbuzz_font_skia.cc

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Clean up comments, fix mac build Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/harfbuzz_font_skia.cc
diff --git a/ui/gfx/harfbuzz_font_skia.cc b/ui/gfx/harfbuzz_font_skia.cc
index 889fa2d22954f8e33f87a53f98cdb4d942536bab..77a01aea3ed69bd6cb893f2c114f6b4e2369e83c 100644
--- a/ui/gfx/harfbuzz_font_skia.cc
+++ b/ui/gfx/harfbuzz_font_skia.cc
@@ -13,7 +13,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "third_party/skia/include/core/SkPaint.h"
+#include "cc/paint/paint_flags.h"
#include "third_party/skia/include/core/SkTypeface.h"
#include "ui/gfx/render_text.h"
#include "ui/gfx/skia_util.h"
@@ -34,7 +34,7 @@ typedef std::pair<HarfBuzzFace, GlyphCache> FaceCache;
struct FontData {
FontData(GlyphCache* glyph_cache) : glyph_cache_(glyph_cache) {}
- SkPaint paint_;
+ cc::PaintFlags paint_;
GlyphCache* glyph_cache_;
};
@@ -53,18 +53,19 @@ void DeleteArrayByType(void* data) {
// Outputs the |width| and |extents| of the glyph with index |codepoint| in
// |paint|'s font.
-void GetGlyphWidthAndExtents(SkPaint* paint,
+void GetGlyphWidthAndExtents(cc::PaintFlags* paint,
hb_codepoint_t codepoint,
hb_position_t* width,
hb_glyph_extents_t* extents) {
DCHECK_LE(codepoint, std::numeric_limits<uint16_t>::max());
- paint->setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+ paint->setTextEncoding(cc::PaintFlags::kGlyphID_TextEncoding);
SkScalar sk_width;
SkRect sk_bounds;
uint16_t glyph = static_cast<uint16_t>(codepoint);
- paint->getTextWidths(&glyph, sizeof(glyph), &sk_width, &sk_bounds);
+ cc::ToSkPaint(*paint).getTextWidths(&glyph, sizeof(glyph), &sk_width,
+ &sk_bounds);
if (width)
*width = SkiaScalarToHarfBuzzUnits(sk_width);
if (extents) {
@@ -90,9 +91,10 @@ hb_bool_t GetGlyph(hb_font_t* font,
bool exists = cache->count(unicode) != 0;
if (!exists) {
- SkPaint* paint = &font_data->paint_;
- paint->setTextEncoding(SkPaint::kUTF32_TextEncoding);
- paint->textToGlyphs(&unicode, sizeof(hb_codepoint_t), &(*cache)[unicode]);
+ cc::PaintFlags* paint = &font_data->paint_;
+ paint->setTextEncoding(cc::PaintFlags::kUTF32_TextEncoding);
+ cc::ToSkPaint(*paint).textToGlyphs(&unicode, sizeof(hb_codepoint_t),
+ &(*cache)[unicode]);
}
*glyph = (*cache)[unicode];
return !!*glyph;

Powered by Google App Engine
This is Rietveld 408576698