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

Side by Side Diff: gm/complexclip_blur_tiled.cpp

Issue 2357273003: Do not set bounds on SkLiteRecorder
Patch Set: 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 | « no previous file | gm/convexpolyclip.cpp » ('j') | src/core/SkCanvas.cpp » ('J')
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 15 matching lines...) Expand all
26 } 26 }
27 27
28 SkISize onISize() override { 28 SkISize onISize() override {
29 return SkISize::Make(WIDTH, HEIGHT); 29 return SkISize::Make(WIDTH, HEIGHT);
30 } 30 }
31 31
32 void onDraw(SkCanvas* canvas) override { 32 void onDraw(SkCanvas* canvas) override {
33 SkPaint blurPaint; 33 SkPaint blurPaint;
34 blurPaint.setImageFilter(SkBlurImageFilter::Make(5.0f, 5.0f, nullptr)); 34 blurPaint.setImageFilter(SkBlurImageFilter::Make(5.0f, 5.0f, nullptr));
35 const SkScalar tileSize = SkIntToScalar(128); 35 const SkScalar tileSize = SkIntToScalar(128);
36 SkRect bounds; 36 SkRect bounds = SkRect::MakeWH(WIDTH, HEIGHT);
37 if (!canvas->getClipBounds(&bounds)) {
38 bounds.setEmpty();
39 }
40 int ts = SkScalarCeilToInt(tileSize); 37 int ts = SkScalarCeilToInt(tileSize);
41 SkImageInfo info = SkImageInfo::MakeN32Premul(ts, ts); 38 SkImageInfo info = SkImageInfo::MakeN32Premul(ts, ts);
42 auto tileSurface(canvas->makeSurface(info)); 39 auto tileSurface(canvas->makeSurface(info));
43 if (!tileSurface) { 40 if (!tileSurface) {
44 tileSurface = SkSurface::MakeRaster(info); 41 tileSurface = SkSurface::MakeRaster(info);
45 } 42 }
46 SkCanvas* tileCanvas = tileSurface->getCanvas(); 43 SkCanvas* tileCanvas = tileSurface->getCanvas();
47 for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tileSize) { 44 for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tileSize) {
48 for (SkScalar x = bounds.left(); x < bounds.right(); x += tileSize) { 45 for (SkScalar x = bounds.left(); x < bounds.right(); x += tileSize) {
49 tileCanvas->save(); 46 tileCanvas->save();
(...skipping 14 matching lines...) Expand all
64 61
65 private: 62 private:
66 typedef GM INHERITED; 63 typedef GM INHERITED;
67 }; 64 };
68 65
69 ////////////////////////////////////////////////////////////////////////////// 66 //////////////////////////////////////////////////////////////////////////////
70 67
71 DEF_GM(return new ComplexClipBlurTiledGM;) 68 DEF_GM(return new ComplexClipBlurTiledGM;)
72 69
73 } 70 }
OLDNEW
« no previous file with comments | « no previous file | gm/convexpolyclip.cpp » ('j') | src/core/SkCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698