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

Unified Diff: ui/gfx/harfbuzz_font_skia.cc

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | ui/gfx/image/image_skia_operations.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..04129588418f114a6f50bd3d308c3b37ea41f329 100644
--- a/ui/gfx/harfbuzz_font_skia.cc
+++ b/ui/gfx/harfbuzz_font_skia.cc
@@ -13,6 +13,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "skia/ext/cdl_paint.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkTypeface.h"
#include "ui/gfx/render_text.h"
@@ -34,7 +35,7 @@ typedef std::pair<HarfBuzzFace, GlyphCache> FaceCache;
struct FontData {
FontData(GlyphCache* glyph_cache) : glyph_cache_(glyph_cache) {}
- SkPaint paint_;
+ CdlPaint paint_;
GlyphCache* glyph_cache_;
};
@@ -53,18 +54,18 @@ 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(CdlPaint* 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(CdlPaint::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);
+ 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]);
+ CdlPaint* paint = &font_data->paint_;
+ paint->setTextEncoding(CdlPaint::kUTF32_TextEncoding);
+ ToSkPaint(*paint).textToGlyphs(&unicode, sizeof(hb_codepoint_t),
+ &(*cache)[unicode]);
}
*glyph = (*cache)[unicode];
return !!*glyph;
« no previous file with comments | « ui/gfx/canvas_skia.cc ('k') | ui/gfx/image/image_skia_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698