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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 183533004: add SkCanvas::NewRaster factory -- a very common use-case in chrome (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« include/core/SkCanvas.h ('K') | « include/core/SkCanvas.h ('k') | no next file » | 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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after
2298 return *paint; 2298 return *paint;
2299 } 2299 }
2300 2300
2301 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); } 2301 const SkRegion& SkCanvas::LayerIter::clip() const { return fImpl->getClip(); }
2302 int SkCanvas::LayerIter::x() const { return fImpl->getX(); } 2302 int SkCanvas::LayerIter::x() const { return fImpl->getX(); }
2303 int SkCanvas::LayerIter::y() const { return fImpl->getY(); } 2303 int SkCanvas::LayerIter::y() const { return fImpl->getY(); }
2304 2304
2305 /////////////////////////////////////////////////////////////////////////////// 2305 ///////////////////////////////////////////////////////////////////////////////
2306 2306
2307 SkCanvas::ClipVisitor::~ClipVisitor() { } 2307 SkCanvas::ClipVisitor::~ClipVisitor() { }
2308
2309 ///////////////////////////////////////////////////////////////////////////////
2310
2311 SkCanvas* SkCanvas::NewRaster(const SkImageInfo& info) {
2312 SkBitmap bitmap;
2313 if (!bitmap.allocPixels(info)) {
2314 return NULL;
2315 }
2316
2317 // should this functionality be moved into allocPixels()?
2318 if (kOpaque_SkAlphaType != info.alphaType()) {
2319 bitmap.eraseColor(0);
scroggo 2014/02/27 19:16:06 Same.
2320 }
2321 return SkNEW_ARGS(SkCanvas, (bitmap));
2322 }
OLDNEW
« include/core/SkCanvas.h ('K') | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698