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/effects/SkTileImageFilter.cpp

Issue 1156583004: Revert of Fix dst bound reported by SkTileImageFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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 | « include/effects/SkTileImageFilter.h ('k') | src/effects/SkXfermodeImageFilter.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 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 "SkTileImageFilter.h" 8 #include "SkTileImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 &shaderMatrix)); 75 &shaderMatrix));
76 paint.setShader(shader); 76 paint.setShader(shader);
77 canvas.translate(-dstRect.fLeft, -dstRect.fTop); 77 canvas.translate(-dstRect.fLeft, -dstRect.fTop);
78 canvas.drawRect(dstRect, paint); 78 canvas.drawRect(dstRect, paint);
79 *dst = device->accessBitmap(false); 79 *dst = device->accessBitmap(false);
80 offset->fX = dstIRect.fLeft; 80 offset->fX = dstIRect.fLeft;
81 offset->fY = dstIRect.fTop; 81 offset->fY = dstIRect.fTop;
82 return true; 82 return true;
83 } 83 }
84 84
85 void SkTileImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
86 *dst = fDstRect;
87 }
88
89 bool SkTileImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, 85 bool SkTileImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
90 SkIRect* dst) const { 86 SkIRect* dst) const {
91 SkRect srcRect; 87 SkRect srcRect;
92 ctm.mapRect(&srcRect, fSrcRect); 88 ctm.mapRect(&srcRect, fSrcRect);
93 SkIRect srcIRect; 89 SkIRect srcIRect;
94 srcRect.roundOut(&srcIRect); 90 srcRect.roundOut(&srcIRect);
95 srcIRect.join(src); 91 srcIRect.join(src);
96 *dst = srcIRect; 92 *dst = srcIRect;
97 return true; 93 return true;
98 } 94 }
99 95
100 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) { 96 SkFlattenable* SkTileImageFilter::CreateProc(SkReadBuffer& buffer) {
101 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 97 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
102 SkRect src, dst; 98 SkRect src, dst;
103 buffer.readRect(&src); 99 buffer.readRect(&src);
104 buffer.readRect(&dst); 100 buffer.readRect(&dst);
105 return Create(src, dst, common.getInput(0)); 101 return Create(src, dst, common.getInput(0));
106 } 102 }
107 103
108 void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const { 104 void SkTileImageFilter::flatten(SkWriteBuffer& buffer) const {
109 this->INHERITED::flatten(buffer); 105 this->INHERITED::flatten(buffer);
110 buffer.writeRect(fSrcRect); 106 buffer.writeRect(fSrcRect);
111 buffer.writeRect(fDstRect); 107 buffer.writeRect(fDstRect);
112 } 108 }
113 109
114 #ifndef SK_IGNORE_TO_STRING 110 #ifndef SK_IGNORE_TO_STRING
115 void SkTileImageFilter::toString(SkString* str) const { 111 void SkTileImageFilter::toString(SkString* str) const {
116 str->appendf("SkTileImageFilter: ("); 112 str->appendf("SkTileImageFilter: (");
117 str->appendf("src: %.2f %.2f %.2f %.2f",
118 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m);
119 str->appendf(" dst: %.2f %.2f %.2f %.2f",
120 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto m);
121 if (this->getInput(0)) {
122 str->appendf("input: (");
123 this->getInput(0)->toString(str);
124 str->appendf(")");
125 }
126 str->append(")"); 113 str->append(")");
127 } 114 }
128 #endif 115 #endif
OLDNEW
« no previous file with comments | « include/effects/SkTileImageFilter.h ('k') | src/effects/SkXfermodeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698