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

Side by Side Diff: skia/ext/pixel_ref_utils.cc

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | skia/ext/skia_utils_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "skia/ext/pixel_ref_utils.h" 5 #include "skia/ext/pixel_ref_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "third_party/skia/include/core/SkBitmapDevice.h" 9 #include "third_party/skia/include/core/SkBitmapDevice.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 }; 344 };
345 345
346 } // namespace 346 } // namespace
347 347
348 void PixelRefUtils::GatherDiscardablePixelRefs( 348 void PixelRefUtils::GatherDiscardablePixelRefs(
349 SkPicture* picture, 349 SkPicture* picture,
350 std::vector<PositionPixelRef>* pixel_refs) { 350 std::vector<PositionPixelRef>* pixel_refs) {
351 pixel_refs->clear(); 351 pixel_refs->clear();
352 DiscardablePixelRefSet pixel_ref_set(pixel_refs); 352 DiscardablePixelRefSet pixel_ref_set(pixel_refs);
353 353
354 SkRect picture_bounds = picture->cullRect();
355 SkIRect picture_ibounds = picture_bounds.roundOut();
354 SkBitmap empty_bitmap; 356 SkBitmap empty_bitmap;
355 empty_bitmap.setInfo(SkImageInfo::MakeUnknown(picture->width(), picture->heigh t())); 357 empty_bitmap.setInfo(SkImageInfo::MakeUnknown(picture_ibounds.width(),
358 picture_ibounds.height()));
356 359
357 GatherPixelRefDevice device(empty_bitmap, &pixel_ref_set); 360 GatherPixelRefDevice device(empty_bitmap, &pixel_ref_set);
358 SkNoSaveLayerCanvas canvas(&device); 361 SkNoSaveLayerCanvas canvas(&device);
359 362
360 canvas.clipRect(SkRect::MakeWH(picture->width(), picture->height()), 363 // Draw the picture pinned against our top/left corner.
361 SkRegion::kIntersect_Op, 364 canvas.translate(-picture_bounds.left(), -picture_bounds.top());
362 false);
363 canvas.drawPicture(picture); 365 canvas.drawPicture(picture);
364 } 366 }
365 367
366 } // namespace skia 368 } // namespace skia
OLDNEW
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | skia/ext/skia_utils_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698