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

Side by Side Diff: src/core/SkPaint.cpp

Issue 977623002: Glyph positions maintain 32 bit integer part. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Warnings as errors on Windows. Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/core/SkDrawProcs.h ('k') | src/device/xps/SkXPSDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPaint.h" 8 #include "SkPaint.h"
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkAutoKern.h" 10 #include "SkAutoKern.h"
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 SkTLazy<SkPaint> fLazy; 797 SkTLazy<SkPaint> fLazy;
798 }; 798 };
799 799
800 static void set_bounds(const SkGlyph& g, SkRect* bounds) { 800 static void set_bounds(const SkGlyph& g, SkRect* bounds) {
801 bounds->set(SkIntToScalar(g.fLeft), 801 bounds->set(SkIntToScalar(g.fLeft),
802 SkIntToScalar(g.fTop), 802 SkIntToScalar(g.fTop),
803 SkIntToScalar(g.fLeft + g.fWidth), 803 SkIntToScalar(g.fLeft + g.fWidth),
804 SkIntToScalar(g.fTop + g.fHeight)); 804 SkIntToScalar(g.fTop + g.fHeight));
805 } 805 }
806 806
807 // 64bits wide, with a 16bit bias. Useful when accumulating lots of 16.16 so
808 // we don't overflow along the way
809 typedef int64_t Sk48Dot16;
810
811 static inline float Sk48Dot16ToScalar(Sk48Dot16 x) {
812 return (float) (x * 1.5258789e-5); // x * (1 / 65536.0f)
813 }
814
815 static void join_bounds_x(const SkGlyph& g, SkRect* bounds, Sk48Dot16 dx) { 807 static void join_bounds_x(const SkGlyph& g, SkRect* bounds, Sk48Dot16 dx) {
816 SkScalar sx = Sk48Dot16ToScalar(dx); 808 SkScalar sx = Sk48Dot16ToScalar(dx);
817 bounds->join(SkIntToScalar(g.fLeft) + sx, 809 bounds->join(SkIntToScalar(g.fLeft) + sx,
818 SkIntToScalar(g.fTop), 810 SkIntToScalar(g.fTop),
819 SkIntToScalar(g.fLeft + g.fWidth) + sx, 811 SkIntToScalar(g.fLeft + g.fWidth) + sx,
820 SkIntToScalar(g.fTop + g.fHeight)); 812 SkIntToScalar(g.fTop + g.fHeight));
821 } 813 }
822 814
823 static void join_bounds_y(const SkGlyph& g, SkRect* bounds, Sk48Dot16 dy) { 815 static void join_bounds_y(const SkGlyph& g, SkRect* bounds, Sk48Dot16 dy) {
824 SkScalar sy = Sk48Dot16ToScalar(dy); 816 SkScalar sy = Sk48Dot16ToScalar(dy);
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 } 2376 }
2385 2377
2386 uint32_t SkPaint::getHash() const { 2378 uint32_t SkPaint::getHash() const {
2387 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields, 2379 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields,
2388 // so fBitfields should be 10 pointers and 6 32-bit values from the start. 2380 // so fBitfields should be 10 pointers and 6 32-bit values from the start.
2389 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * sizeof(uint32_t), 2381 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * sizeof(uint32_t),
2390 SkPaint_notPackedTightly); 2382 SkPaint_notPackedTightly);
2391 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), 2383 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this),
2392 offsetof(SkPaint, fBitfields) + sizeof(fBitfields )); 2384 offsetof(SkPaint, fBitfields) + sizeof(fBitfields ));
2393 } 2385 }
OLDNEW
« no previous file with comments | « src/core/SkDrawProcs.h ('k') | src/device/xps/SkXPSDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698