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

Side by Side Diff: src/utils/SkPictureUtils.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 | « src/utils/SkGatherPixelRefsAndRects.cpp ('k') | src/utils/debugger/SkDebugCanvas.h » ('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 2012 Google Inc. 2 * Copyright 2012 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 typedef SkBaseDevice INHERITED; 190 typedef SkBaseDevice INHERITED;
191 }; 191 };
192 192
193 SkData* SkPictureUtils::GatherPixelRefs(const SkPicture* pict, const SkRect& are a) { 193 SkData* SkPictureUtils::GatherPixelRefs(const SkPicture* pict, const SkRect& are a) {
194 if (NULL == pict) { 194 if (NULL == pict) {
195 return NULL; 195 return NULL;
196 } 196 }
197 197
198 // this test also handles if either area or pict's width/height are empty 198 // this test also handles if either area or pict's width/height are empty
199 if (!SkRect::Intersects(area, 199 if (!SkRect::Intersects(area, pict->cullRect())) {
200 SkRect::MakeWH(SkIntToScalar(pict->width()),
201 SkIntToScalar(pict->height())))) {
202 return NULL; 200 return NULL;
203 } 201 }
204 202
205 SkTDArray<SkPixelRef*> array; 203 SkTDArray<SkPixelRef*> array;
206 PixelRefSet prset(&array); 204 PixelRefSet prset(&array);
207 205
208 GatherPixelRefDevice device(pict->width(), pict->height(), &prset); 206 GatherPixelRefDevice device(SkScalarCeilToInt(pict->cullRect().width()),
207 SkScalarCeilToInt(pict->cullRect().height()),
208 &prset);
209 SkNoSaveLayerCanvas canvas(&device); 209 SkNoSaveLayerCanvas canvas(&device);
210 210
211 canvas.clipRect(area, SkRegion::kIntersect_Op, false); 211 canvas.clipRect(area, SkRegion::kIntersect_Op, false);
212 canvas.drawPicture(pict); 212 canvas.drawPicture(pict);
213 213
214 SkData* data = NULL; 214 SkData* data = NULL;
215 int count = array.count(); 215 int count = array.count();
216 if (count > 0) { 216 if (count > 0) {
217 data = SkData::NewFromMalloc(array.detach(), count * sizeof(SkPixelRef*) ); 217 data = SkData::NewFromMalloc(array.detach(), count * sizeof(SkPixelRef*) );
218 } 218 }
219 return data; 219 return data;
220 } 220 }
OLDNEW
« no previous file with comments | « src/utils/SkGatherPixelRefsAndRects.cpp ('k') | src/utils/debugger/SkDebugCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698