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

Side by Side Diff: gm/complexclip_blur_tiled.cpp

Issue 2355483002: abstract name of clipping ops, to transtion to a more restricted set (Closed)
Patch Set: no need for ifdef for globals Created 4 years, 3 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 | « gm/complexclip3.cpp ('k') | gm/convexpolyclip.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 2016 Google Inc. 2 * Copyright 2016 Google Inc.
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 "gm.h" 8 #include "gm.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkRRect.h" 10 #include "SkRRect.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 SkCanvas* tileCanvas = tileSurface->getCanvas(); 46 SkCanvas* tileCanvas = tileSurface->getCanvas();
47 for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tileSize) { 47 for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tileSize) {
48 for (SkScalar x = bounds.left(); x < bounds.right(); x += tileSize) { 48 for (SkScalar x = bounds.left(); x < bounds.right(); x += tileSize) {
49 tileCanvas->save(); 49 tileCanvas->save();
50 tileCanvas->clear(0); 50 tileCanvas->clear(0);
51 tileCanvas->translate(-x, -y); 51 tileCanvas->translate(-x, -y);
52 SkRect rect = SkRect::MakeWH(WIDTH, HEIGHT); 52 SkRect rect = SkRect::MakeWH(WIDTH, HEIGHT);
53 tileCanvas->saveLayer(&rect, &blurPaint); 53 tileCanvas->saveLayer(&rect, &blurPaint);
54 SkRRect rrect = SkRRect::MakeRectXY(rect.makeInset(20, 20), 25, 25); 54 SkRRect rrect = SkRRect::MakeRectXY(rect.makeInset(20, 20), 25, 25);
55 tileCanvas->clipRRect(rrect, SkRegion::kDifference_Op, true); 55 tileCanvas->clipRRect(rrect, SkCanvas::kDifference_Op, true);
56 SkPaint paint; 56 SkPaint paint;
57 tileCanvas->drawRect(rect, paint); 57 tileCanvas->drawRect(rect, paint);
58 tileCanvas->restore(); 58 tileCanvas->restore();
59 tileCanvas->restore(); 59 tileCanvas->restore();
60 canvas->drawImage(tileSurface->makeImageSnapshot().get(), x, y); 60 canvas->drawImage(tileSurface->makeImageSnapshot().get(), x, y);
61 } 61 }
62 } 62 }
63 } 63 }
64 64
65 private: 65 private:
66 typedef GM INHERITED; 66 typedef GM INHERITED;
67 }; 67 };
68 68
69 ////////////////////////////////////////////////////////////////////////////// 69 //////////////////////////////////////////////////////////////////////////////
70 70
71 DEF_GM(return new ComplexClipBlurTiledGM;) 71 DEF_GM(return new ComplexClipBlurTiledGM;)
72 72
73 } 73 }
OLDNEW
« no previous file with comments | « gm/complexclip3.cpp ('k') | gm/convexpolyclip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698