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

Side by Side Diff: src/effects/SkPictureImageFilter.cpp

Issue 2366723004: Revert of Create special surfaces according to original device (not always in N32) (Closed)
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 | « src/effects/SkPaintImageFilter.cpp ('k') | src/effects/SkTileImageFilter.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 The Android Open Source Project 2 * Copyright 2013 The Android Open Source Project
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 "SkPictureImageFilter.h" 8 #include "SkPictureImageFilter.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 SkRect floatBounds; 112 SkRect floatBounds;
113 ctx.ctm().mapRect(&floatBounds, fCropRect); 113 ctx.ctm().mapRect(&floatBounds, fCropRect);
114 SkIRect bounds = floatBounds.roundOut(); 114 SkIRect bounds = floatBounds.roundOut();
115 if (!bounds.intersect(ctx.clipBounds())) { 115 if (!bounds.intersect(ctx.clipBounds())) {
116 return nullptr; 116 return nullptr;
117 } 117 }
118 118
119 SkASSERT(!bounds.isEmpty()); 119 SkASSERT(!bounds.isEmpty());
120 120
121 sk_sp<SkSpecialSurface> surf(source->makeSurface(ctx.outputProperties(), bou nds.size())); 121 SkImageInfo info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), kPr emul_SkAlphaType);
122 sk_sp<SkSpecialSurface> surf(source->makeSurface(info));
122 if (!surf) { 123 if (!surf) {
123 return nullptr; 124 return nullptr;
124 } 125 }
125 126
126 SkCanvas* canvas = surf->getCanvas(); 127 SkCanvas* canvas = surf->getCanvas();
127 SkASSERT(canvas); 128 SkASSERT(canvas);
128 129
129 canvas->clear(0x0); 130 canvas->clear(0x0);
130 131
131 if (kDeviceSpace_PictureResolution == fPictureResolution || 132 if (kDeviceSpace_PictureResolution == fPictureResolution ||
(...skipping 27 matching lines...) Expand all
159 160
160 SkRect localBounds = SkRect::Make(ctx.clipBounds()); 161 SkRect localBounds = SkRect::Make(ctx.clipBounds());
161 inverseCtm.mapRect(&localBounds); 162 inverseCtm.mapRect(&localBounds);
162 if (!localBounds.intersect(fCropRect)) { 163 if (!localBounds.intersect(fCropRect)) {
163 return; 164 return;
164 } 165 }
165 SkIRect localIBounds = localBounds.roundOut(); 166 SkIRect localIBounds = localBounds.roundOut();
166 167
167 sk_sp<SkSpecialImage> localImg; 168 sk_sp<SkSpecialImage> localImg;
168 { 169 {
169 sk_sp<SkSpecialSurface> localSurface(source->makeSurface(ctx.outputPrope rties(), 170 const SkImageInfo info = SkImageInfo::MakeN32(localIBounds.width(), loca lIBounds.height(),
170 localIBounds.si ze())); 171 kPremul_SkAlphaType);
172
173 sk_sp<SkSpecialSurface> localSurface(source->makeSurface(info));
171 if (!localSurface) { 174 if (!localSurface) {
172 return; 175 return;
173 } 176 }
174 177
175 SkCanvas* localCanvas = localSurface->getCanvas(); 178 SkCanvas* localCanvas = localSurface->getCanvas();
176 SkASSERT(localCanvas); 179 SkASSERT(localCanvas);
177 180
178 localCanvas->clear(0x0); 181 localCanvas->clear(0x0);
179 182
180 localCanvas->translate(-SkIntToScalar(localIBounds.fLeft), 183 localCanvas->translate(-SkIntToScalar(localIBounds.fLeft),
(...skipping 23 matching lines...) Expand all
204 str->appendf("crop: (%f,%f,%f,%f) ", 207 str->appendf("crop: (%f,%f,%f,%f) ",
205 fCropRect.fLeft, fCropRect.fTop, fCropRect.fRight, fCropRect.fB ottom); 208 fCropRect.fLeft, fCropRect.fTop, fCropRect.fRight, fCropRect.fB ottom);
206 if (fPicture) { 209 if (fPicture) {
207 str->appendf("picture: (%f,%f,%f,%f)", 210 str->appendf("picture: (%f,%f,%f,%f)",
208 fPicture->cullRect().fLeft, fPicture->cullRect().fTop, 211 fPicture->cullRect().fLeft, fPicture->cullRect().fTop,
209 fPicture->cullRect().fRight, fPicture->cullRect().fBottom); 212 fPicture->cullRect().fRight, fPicture->cullRect().fBottom);
210 } 213 }
211 str->append(")"); 214 str->append(")");
212 } 215 }
213 #endif 216 #endif
OLDNEW
« no previous file with comments | « src/effects/SkPaintImageFilter.cpp ('k') | src/effects/SkTileImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698