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

Side by Side Diff: gm/tileimagefilter.cpp

Issue 106933002: Implement srcRect and dstRect functionality in SkBitmapSource. This is required for the "preserveAs… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix SkTileImageFilter to respect CTM, and not to request an invalid subset Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkTileImageFilter.h" 9 #include "SkTileImageFilter.h"
10 #include "SkBitmapSource.h" 10 #include "SkBitmapSource.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 } 64 }
65 65
66 virtual SkISize onISize() { 66 virtual SkISize onISize() {
67 return make_isize(WIDTH, HEIGHT); 67 return make_isize(WIDTH, HEIGHT);
68 } 68 }
69 69
70 void drawClippedBitmap(SkCanvas* canvas, const SkBitmap& bitmap, const SkPai nt& paint, 70 void drawClippedBitmap(SkCanvas* canvas, const SkBitmap& bitmap, const SkPai nt& paint,
71 SkScalar x, SkScalar y) { 71 SkScalar x, SkScalar y) {
72 canvas->save(); 72 canvas->save();
73 canvas->clipRect(SkRect::MakeXYWH(x, y, 73 canvas->translate(x, y);
74 canvas->clipRect(SkRect::MakeXYWH(0, 0,
74 SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height()))); 75 SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height())));
75 canvas->drawBitmap(bitmap, x, y, &paint); 76 canvas->drawBitmap(bitmap, 0, 0, &paint);
76 canvas->restore(); 77 canvas->restore();
77 } 78 }
78 79
79 virtual void onDraw(SkCanvas* canvas) { 80 virtual void onDraw(SkCanvas* canvas) {
80 if (!fInitialized) { 81 if (!fInitialized) {
81 make_bitmap(); 82 make_bitmap();
82 make_checkerboard(); 83 make_checkerboard();
83 fInitialized = true; 84 fInitialized = true;
84 } 85 }
85 canvas->clear(0x00000000); 86 canvas->clear(0x00000000);
(...skipping 27 matching lines...) Expand all
113 SkBitmap fBitmap, fCheckerboard; 114 SkBitmap fBitmap, fCheckerboard;
114 bool fInitialized; 115 bool fInitialized;
115 }; 116 };
116 117
117 ////////////////////////////////////////////////////////////////////////////// 118 //////////////////////////////////////////////////////////////////////////////
118 119
119 static GM* MyFactory(void*) { return new TileImageFilterGM; } 120 static GM* MyFactory(void*) { return new TileImageFilterGM; }
120 static GMRegistry reg(MyFactory); 121 static GMRegistry reg(MyFactory);
121 122
122 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698