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

Side by Side Diff: ui/gfx/canvas.cc

Issue 2682123003: Remove uses of skia::ReadPixels(PaintCanvas) (Closed)
Patch Set: more readpixels Created 3 years, 10 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 | « ui/gfx/canvas.h ('k') | ui/gfx/color_analysis_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/gfx/canvas.h" 5 #include "ui/gfx/canvas.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 flags->setShader(CreateImageRepShader(image_rep, SkShader::kRepeat_TileMode, 538 flags->setShader(CreateImageRepShader(image_rep, SkShader::kRepeat_TileMode,
539 shader_scale)); 539 shader_scale));
540 flags->setBlendMode(SkBlendMode::kSrcOver); 540 flags->setBlendMode(SkBlendMode::kSrcOver);
541 return true; 541 return true;
542 } 542 }
543 543
544 void Canvas::Transform(const gfx::Transform& transform) { 544 void Canvas::Transform(const gfx::Transform& transform) {
545 canvas_->concat(transform.matrix()); 545 canvas_->concat(transform.matrix());
546 } 546 }
547 547
548 SkBitmap Canvas::ToBitmap() {
549 SkBitmap bitmap;
550 bitmap.setInfo(canvas_->imageInfo());
551 canvas_->readPixels(&bitmap, 0, 0);
552 return bitmap;
553 }
554
548 bool Canvas::IntersectsClipRect(const SkRect& rect) { 555 bool Canvas::IntersectsClipRect(const SkRect& rect) {
549 SkRect clip; 556 SkRect clip;
550 return canvas_->getLocalClipBounds(&clip) && clip.intersects(rect); 557 return canvas_->getLocalClipBounds(&clip) && clip.intersects(rect);
551 } 558 }
552 559
553 void Canvas::DrawImageIntHelper(const ImageSkiaRep& image_rep, 560 void Canvas::DrawImageIntHelper(const ImageSkiaRep& image_rep,
554 int src_x, 561 int src_x,
555 int src_y, 562 int src_y,
556 int src_w, 563 int src_w,
557 int src_h, 564 int src_h,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 flags.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); 600 flags.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality);
594 flags.setShader(CreateImageRepShaderForScale( 601 flags.setShader(CreateImageRepShaderForScale(
595 image_rep, SkShader::kRepeat_TileMode, shader_scale, 602 image_rep, SkShader::kRepeat_TileMode, shader_scale,
596 remove_image_scale ? image_rep.scale() : 1.f)); 603 remove_image_scale ? image_rep.scale() : 1.f));
597 604
598 // The rect will be filled by the bitmap. 605 // The rect will be filled by the bitmap.
599 canvas_->drawRect(dest_rect, flags); 606 canvas_->drawRect(dest_rect, flags);
600 } 607 }
601 608
602 } // namespace gfx 609 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/canvas.h ('k') | ui/gfx/color_analysis_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698