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

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

Issue 159723006: add peekPixels to canvas (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkConfig8888.h" 9 #include "SkConfig8888.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device, 379 void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
380 int x, int y, const SkPaint& paint) { 380 int x, int y, const SkPaint& paint) {
381 const SkBitmap& src = device->accessBitmap(false); 381 const SkBitmap& src = device->accessBitmap(false);
382 draw.drawSprite(src, x, y, paint); 382 draw.drawSprite(src, x, y, paint);
383 } 383 }
384 384
385 SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info) { 385 SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info) {
386 return SkSurface::NewRaster(info); 386 return SkSurface::NewRaster(info);
387 } 387 }
388 388
389 const void* SkBitmapDevice::peekPixels(SkImageInfo* info, size_t* rowBytes) {
390 if (fBitmap.getPixels() && fBitmap.asImageInfo(info)) {
391 if (rowBytes) {
392 *rowBytes = fBitmap.rowBytes();
393 }
394 return fBitmap.getPixels();
395 }
396 return NULL;
397 }
398
389 /////////////////////////////////////////////////////////////////////////////// 399 ///////////////////////////////////////////////////////////////////////////////
390 400
391 bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) { 401 bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
392 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { 402 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
393 // we're cool with the paint as is 403 // we're cool with the paint as is
394 return false; 404 return false;
395 } 405 }
396 406
397 if (SkBitmap::kARGB_8888_Config != fBitmap.config() || 407 if (SkBitmap::kARGB_8888_Config != fBitmap.config() ||
398 paint.getRasterizer() || 408 paint.getRasterizer() ||
399 paint.getPathEffect() || 409 paint.getPathEffect() ||
400 paint.isFakeBoldText() || 410 paint.isFakeBoldText() ||
401 paint.getStyle() != SkPaint::kFill_Style || 411 paint.getStyle() != SkPaint::kFill_Style ||
402 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) { 412 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) {
403 // turn off lcd 413 // turn off lcd
404 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag; 414 flags->fFlags = paint.getFlags() & ~SkPaint::kLCDRenderText_Flag;
405 flags->fHinting = paint.getHinting(); 415 flags->fHinting = paint.getHinting();
406 return true; 416 return true;
407 } 417 }
408 // we're cool with the paint as is 418 // we're cool with the paint as is
409 return false; 419 return false;
410 } 420 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698