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

Side by Side Diff: gm/pictureshader.cpp

Issue 513983002: Try out scalar picture sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT again Created 6 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/optimizations.cpp ('k') | gm/pictureshadertile.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 2014 Google Inc. 2 * Copyright 2014 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 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 12 matching lines...) Expand all
23 }; 23 };
24 24
25 class PictureShaderGM : public skiagm::GM { 25 class PictureShaderGM : public skiagm::GM {
26 public: 26 public:
27 PictureShaderGM(SkScalar tileSize, SkScalar sceneSize) 27 PictureShaderGM(SkScalar tileSize, SkScalar sceneSize)
28 : fTileSize(tileSize) 28 : fTileSize(tileSize)
29 , fSceneSize(sceneSize) { 29 , fSceneSize(sceneSize) {
30 30
31 // Build the picture. 31 // Build the picture.
32 SkPictureRecorder recorder; 32 SkPictureRecorder recorder;
33 SkCanvas* pictureCanvas = recorder.beginRecording(SkScalarRoundToInt(til eSize), 33 SkCanvas* pictureCanvas = recorder.beginRecording(tileSize, tileSize, NU LL, 0);
34 SkScalarRoundToInt(til eSize),
35 NULL, 0);
36 this->drawTile(pictureCanvas); 34 this->drawTile(pictureCanvas);
37 fPicture.reset(recorder.endRecording()); 35 fPicture.reset(recorder.endRecording());
38 36
39 // Build a reference bitmap. 37 // Build a reference bitmap.
40 fBitmap.allocN32Pixels(SkScalarRoundToInt(tileSize), SkScalarRoundToInt( tileSize)); 38 fBitmap.allocN32Pixels(SkScalarCeilToInt(tileSize), SkScalarCeilToInt(ti leSize));
41 fBitmap.eraseColor(SK_ColorTRANSPARENT); 39 fBitmap.eraseColor(SK_ColorTRANSPARENT);
42 SkCanvas bitmapCanvas(fBitmap); 40 SkCanvas bitmapCanvas(fBitmap);
43 this->drawTile(&bitmapCanvas); 41 this->drawTile(&bitmapCanvas);
44 } 42 }
45 43
46 protected: 44 protected:
47 virtual uint32_t onGetFlags() const SK_OVERRIDE { 45 virtual uint32_t onGetFlags() const SK_OVERRIDE {
48 return kSkipTiled_Flag; 46 return kSkipTiled_Flag;
49 } 47 }
50 48
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 SkScalar fTileSize; 154 SkScalar fTileSize;
157 SkScalar fSceneSize; 155 SkScalar fSceneSize;
158 156
159 SkAutoTUnref<SkPicture> fPicture; 157 SkAutoTUnref<SkPicture> fPicture;
160 SkBitmap fBitmap; 158 SkBitmap fBitmap;
161 159
162 typedef GM INHERITED; 160 typedef GM INHERITED;
163 }; 161 };
164 162
165 DEF_GM( return SkNEW_ARGS(PictureShaderGM, (50, 100)); ) 163 DEF_GM( return SkNEW_ARGS(PictureShaderGM, (50, 100)); )
OLDNEW
« no previous file with comments | « gm/optimizations.cpp ('k') | gm/pictureshadertile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698