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

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

Issue 1012763002: Test for glyphs which straddle the edge of device space. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Check full range if ranges are to be checked. 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 | « no previous file | no next file » | 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 "SkDraw.h" 8 #include "SkDraw.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 15 matching lines...) Expand all
26 #include "SkTextMapStateProc.h" 26 #include "SkTextMapStateProc.h"
27 #include "SkTLazy.h" 27 #include "SkTLazy.h"
28 #include "SkUtils.h" 28 #include "SkUtils.h"
29 #include "SkVertState.h" 29 #include "SkVertState.h"
30 30
31 #include "SkAutoKern.h" 31 #include "SkAutoKern.h"
32 #include "SkBitmapProcShader.h" 32 #include "SkBitmapProcShader.h"
33 #include "SkDrawProcs.h" 33 #include "SkDrawProcs.h"
34 #include "SkMatrixUtils.h" 34 #include "SkMatrixUtils.h"
35 35
36
37 //#define TRACE_BITMAP_DRAWS 36 //#define TRACE_BITMAP_DRAWS
38 37
39 38
40 /** Helper for allocating small blitters on the stack. 39 /** Helper for allocating small blitters on the stack.
41 */ 40 */
42 class SkAutoBlitterChoose : SkNoncopyable { 41 class SkAutoBlitterChoose : SkNoncopyable {
43 public: 42 public:
44 SkAutoBlitterChoose() { 43 SkAutoBlitterChoose() {
45 fBlitter = NULL; 44 fBlitter = NULL;
46 } 45 }
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 1436
1438 // disable warning : local variable used without having been initialized 1437 // disable warning : local variable used without having been initialized
1439 #if defined _WIN32 && _MSC_VER >= 1300 1438 #if defined _WIN32 && _MSC_VER >= 1300
1440 #pragma warning ( push ) 1439 #pragma warning ( push )
1441 #pragma warning ( disable : 4701 ) 1440 #pragma warning ( disable : 4701 )
1442 #endif 1441 #endif
1443 1442
1444 ////////////////////////////////////////////////////////////////////////////// 1443 //////////////////////////////////////////////////////////////////////////////
1445 1444
1446 static void D1G_RectClip(const SkDraw1Glyph& state, Sk48Dot16 fx, Sk48Dot16 fy, const SkGlyph& glyph) { 1445 static void D1G_RectClip(const SkDraw1Glyph& state, Sk48Dot16 fx, Sk48Dot16 fy, const SkGlyph& glyph) {
1446 // Prevent glyphs from being drawn outside of or straddling the edge of devi ce space.
1447 if ((fx >> 16) > INT_MAX - (INT16_MAX + UINT16_MAX) ||
1448 (fx >> 16) < INT_MIN - (INT16_MIN + 0 /*UINT16_MIN*/) ||
1449 (fy >> 16) > INT_MAX - (INT16_MAX + UINT16_MAX) ||
1450 (fy >> 16) < INT_MIN - (INT16_MIN + 0 /*UINT16_MIN*/))
1451 {
1452 return;
1453 }
1454
1447 int left = Sk48Dot16FloorToInt(fx); 1455 int left = Sk48Dot16FloorToInt(fx);
1448 int top = Sk48Dot16FloorToInt(fy); 1456 int top = Sk48Dot16FloorToInt(fy);
1449 SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0); 1457 SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0);
1450 SkASSERT((NULL == state.fClip && state.fAAClip) || 1458 SkASSERT((NULL == state.fClip && state.fAAClip) ||
1451 (state.fClip && NULL == state.fAAClip && state.fClip->isRect())); 1459 (state.fClip && NULL == state.fAAClip && state.fClip->isRect()));
1452 1460
1453 left += glyph.fLeft; 1461 left += glyph.fLeft;
1454 top += glyph.fTop; 1462 top += glyph.fTop;
1455 1463
1456 int right = left + glyph.fWidth; 1464 int right = left + glyph.fWidth;
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
2260 mask->fImage = SkMask::AllocImage(size); 2268 mask->fImage = SkMask::AllocImage(size);
2261 memset(mask->fImage, 0, mask->computeImageSize()); 2269 memset(mask->fImage, 0, mask->computeImageSize());
2262 } 2270 }
2263 2271
2264 if (SkMask::kJustComputeBounds_CreateMode != mode) { 2272 if (SkMask::kJustComputeBounds_CreateMode != mode) {
2265 draw_into_mask(*mask, devPath, style); 2273 draw_into_mask(*mask, devPath, style);
2266 } 2274 }
2267 2275
2268 return true; 2276 return true;
2269 } 2277 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698