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

Side by Side Diff: include/core/SkDevice.h

Issue 197433002: support direct writing to top layer (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
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/utils/SkDeferredCanvas.h » ('j') | 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 2010 The Android Open Source Project 3 * Copyright 2010 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 #ifndef SkDevice_DEFINED 10 #ifndef SkDevice_DEFINED
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 * If the bitmap has config kARGB_8888_Config then the config8888 param 131 * If the bitmap has config kARGB_8888_Config then the config8888 param
132 * will determines how the pixel valuess are intepreted. If the bitmap is 132 * will determines how the pixel valuess are intepreted. If the bitmap is
133 * not kARGB_8888_Config then this parameter is ignored. 133 * not kARGB_8888_Config then this parameter is ignored.
134 */ 134 */
135 virtual void writePixels(const SkBitmap& bitmap, int x, int y, 135 virtual void writePixels(const SkBitmap& bitmap, int x, int y,
136 SkCanvas::Config8888 config8888 = SkCanvas::kNative _Premul_Config8888); 136 SkCanvas::Config8888 config8888 = SkCanvas::kNative _Premul_Config8888);
137 #endif 137 #endif
138 138
139 bool writePixelsDirect(const SkImageInfo&, const void*, size_t rowBytes, int x, int y); 139 bool writePixelsDirect(const SkImageInfo&, const void*, size_t rowBytes, int x, int y);
140 140
141 void* accessPixels(SkImageInfo* info, size_t* rowBytes);
142
141 /** 143 /**
142 * Return the device's associated gpu render target, or NULL. 144 * Return the device's associated gpu render target, or NULL.
143 */ 145 */
144 virtual GrRenderTarget* accessRenderTarget() = 0; 146 virtual GrRenderTarget* accessRenderTarget() = 0;
145 147
146 148
147 /** 149 /**
148 * Return the device's origin: its offset in device coordinates from 150 * Return the device's origin: its offset in device coordinates from
149 * the default origin in its canvas' matrix/clip 151 * the default origin in its canvas' matrix/clip
150 */ 152 */
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 395
394 /** 396 /**
395 * The caller is responsible for "pre-clipping" the src. The impl can assum e that the src 397 * The caller is responsible for "pre-clipping" the src. The impl can assum e that the src
396 * image at the specified x,y offset will fit within the device's bounds. 398 * image at the specified x,y offset will fit within the device's bounds.
397 * 399 *
398 * This is explicitly asserted in writePixelsDirect(), the public way to ca ll this. 400 * This is explicitly asserted in writePixelsDirect(), the public way to ca ll this.
399 */ 401 */
400 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i nt y); 402 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i nt y);
401 403
402 /** 404 /**
405 * Default impl returns NULL.
406 */
407 virtual void* onAccessPixels(SkImageInfo* info, size_t* rowBytes);
408
409 /**
403 * Leaky properties are those which the device should be applying but it is n't. 410 * Leaky properties are those which the device should be applying but it is n't.
404 * These properties will be applied by the draw, when and as it can. 411 * These properties will be applied by the draw, when and as it can.
405 * If the device does handle a property, that property should be set to the identity value 412 * If the device does handle a property, that property should be set to the identity value
406 * for that property, effectively making it non-leaky. 413 * for that property, effectively making it non-leaky.
407 */ 414 */
408 SkDeviceProperties fLeakyProperties; 415 SkDeviceProperties fLeakyProperties;
409 416
410 private: 417 private:
411 friend class SkCanvas; 418 friend class SkCanvas;
412 friend struct DeviceCM; //for setMatrixClip 419 friend struct DeviceCM; //for setMatrixClip
413 friend class SkDraw; 420 friend class SkDraw;
414 friend class SkDrawIter; 421 friend class SkDrawIter;
415 friend class SkDeviceFilteredPaint; 422 friend class SkDeviceFilteredPaint;
416 friend class SkDeviceImageFilterProxy; 423 friend class SkDeviceImageFilterProxy;
417 friend class DeferredDevice; // for newSurface 424 friend class SkDeferredDevice; // for newSurface
418 425
419 friend class SkSurface_Raster; 426 friend class SkSurface_Raster;
420 427
421 // used to change the backend's pixels (and possibly config/rowbytes) 428 // used to change the backend's pixels (and possibly config/rowbytes)
422 // but cannot change the width/height, so there should be no change to 429 // but cannot change the width/height, so there should be no change to
423 // any clip information. 430 // any clip information.
424 // TODO: move to SkBitmapDevice 431 // TODO: move to SkBitmapDevice
425 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) = 0; 432 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) = 0;
426 433
427 // just called by SkCanvas when built as a layer 434 // just called by SkCanvas when built as a layer
(...skipping 25 matching lines...) Expand all
453 SkMetaData* fMetaData; 460 SkMetaData* fMetaData;
454 461
455 #ifdef SK_DEBUG 462 #ifdef SK_DEBUG
456 bool fAttachedToCanvas; 463 bool fAttachedToCanvas;
457 #endif 464 #endif
458 465
459 typedef SkRefCnt INHERITED; 466 typedef SkRefCnt INHERITED;
460 }; 467 };
461 468
462 #endif 469 #endif
OLDNEW
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/utils/SkDeferredCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698