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

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

Issue 1432443004: Remove SkDevice and SkBaseDevice outside skia/ext/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pass SkPixmap by pointer to MakeBitmapOpaque Created 5 years, 1 month 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/base/clipboard/clipboard_win.cc ('k') | ui/gfx/nine_image_painter_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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 // static 114 // static
115 int Canvas::DefaultCanvasTextAlignment() { 115 int Canvas::DefaultCanvasTextAlignment() {
116 return base::i18n::IsRTL() ? TEXT_ALIGN_RIGHT : TEXT_ALIGN_LEFT; 116 return base::i18n::IsRTL() ? TEXT_ALIGN_RIGHT : TEXT_ALIGN_LEFT;
117 } 117 }
118 118
119 ImageSkiaRep Canvas::ExtractImageRep() const { 119 ImageSkiaRep Canvas::ExtractImageRep() const {
120 // Make a bitmap to return, and a canvas to draw into it. We don't just want 120 // Make a bitmap to return, and a canvas to draw into it. We don't just want
121 // to call extractSubset or the copy constructor, since we want an actual copy 121 // to call extractSubset or the copy constructor, since we want an actual copy
122 // of the bitmap. 122 // of the bitmap.
123 const SkISize size = canvas_->getDeviceSize(); 123 const SkISize size = canvas_->getBaseLayerSize();
124 SkBitmap result; 124 SkBitmap result;
125 result.allocN32Pixels(size.width(), size.height()); 125 result.allocN32Pixels(size.width(), size.height());
126 126
127 canvas_->readPixels(&result, 0, 0); 127 canvas_->readPixels(&result, 0, 0);
128 return ImageSkiaRep(result, image_scale_); 128 return ImageSkiaRep(result, image_scale_);
129 } 129 }
130 130
131 void Canvas::DrawDashedRect(const Rect& rect, SkColor color) { 131 void Canvas::DrawDashedRect(const Rect& rect, SkColor color) {
132 if (rect.IsEmpty()) 132 if (rect.IsEmpty())
133 return; 133 return;
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 // by the paint). 584 // by the paint).
585 SkPaint p(paint); 585 SkPaint p(paint);
586 p.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); 586 p.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality);
587 p.setShader(shader.get()); 587 p.setShader(shader.get());
588 588
589 // The rect will be filled by the bitmap. 589 // The rect will be filled by the bitmap.
590 canvas_->drawRect(dest_rect, p); 590 canvas_->drawRect(dest_rect, p);
591 } 591 }
592 592
593 } // namespace gfx 593 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_win.cc ('k') | ui/gfx/nine_image_painter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698