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

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

Issue 196543004: make onReadPixels protected and have default impl (so we can remove chrome override) (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 | « no previous file | src/core/SkDevice.cpp » ('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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 SkCanvas::Config8888 config8888); 329 SkCanvas::Config8888 config8888);
330 330
331 /////////////////////////////////////////////////////////////////////////// 331 ///////////////////////////////////////////////////////////////////////////
332 332
333 /** Update as needed the pixel value in the bitmap, so that the caller can 333 /** Update as needed the pixel value in the bitmap, so that the caller can
334 access the pixels directly. 334 access the pixels directly.
335 @return The device contents as a bitmap 335 @return The device contents as a bitmap
336 */ 336 */
337 virtual const SkBitmap& onAccessBitmap() = 0; 337 virtual const SkBitmap& onAccessBitmap() = 0;
338 338
339 /**
340 * Implements readPixels API. The caller will ensure that:
341 * 1. bitmap has pixel config kARGB_8888_Config.
342 * 2. bitmap has pixels.
343 * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is
344 * contained in the device bounds.
345 */
346 virtual bool onReadPixels(const SkBitmap& bitmap,
347 int x, int y,
348 SkCanvas::Config8888 config8888) = 0;
349
350 /** Called when this device is installed into a Canvas. Balanced by a call 339 /** Called when this device is installed into a Canvas. Balanced by a call
351 to unlockPixels() when the device is removed from a Canvas. 340 to unlockPixels() when the device is removed from a Canvas.
352 */ 341 */
353 virtual void lockPixels() = 0; 342 virtual void lockPixels() = 0;
354 virtual void unlockPixels() = 0; 343 virtual void unlockPixels() = 0;
355 344
356 /** 345 /**
357 * Returns true if the device allows processing of this imagefilter. If 346 * Returns true if the device allows processing of this imagefilter. If
358 * false is returned, then the filter is ignored. This may happen for 347 * false is returned, then the filter is ignored. This may happen for
359 * some subclasses that do not support pixel manipulations after drawing 348 * some subclasses that do not support pixel manipulations after drawing
(...skipping 25 matching lines...) Expand all
385 static const SkCanvas::Config8888 kPMColorAlias; 374 static const SkCanvas::Config8888 kPMColorAlias;
386 375
387 protected: 376 protected:
388 // default impl returns NULL 377 // default impl returns NULL
389 virtual SkSurface* newSurface(const SkImageInfo&); 378 virtual SkSurface* newSurface(const SkImageInfo&);
390 379
391 // default impl returns NULL 380 // default impl returns NULL
392 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); 381 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes);
393 382
394 /** 383 /**
384 * Implements readPixels API. The caller will ensure that:
385 * 1. bitmap has pixel config kARGB_8888_Config.
386 * 2. bitmap has pixels.
387 * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is
388 * contained in the device bounds.
389 */
390 virtual bool onReadPixels(const SkBitmap& bitmap,
391 int x, int y,
392 SkCanvas::Config8888 config8888);
393
394 /**
395 * The caller is responsible for "pre-clipping" the src. The impl can assum e that the src 395 * 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. 396 * image at the specified x,y offset will fit within the device's bounds.
397 * 397 *
398 * This is explicitly asserted in writePixelsDirect(), the public way to ca ll this. 398 * This is explicitly asserted in writePixelsDirect(), the public way to ca ll this.
399 */ 399 */
400 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i nt y); 400 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i nt y);
401 401
402 /** 402 /**
403 * Leaky properties are those which the device should be applying but it is n't. 403 * 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. 404 * These properties will be applied by the draw, when and as it can.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 SkMetaData* fMetaData; 453 SkMetaData* fMetaData;
454 454
455 #ifdef SK_DEBUG 455 #ifdef SK_DEBUG
456 bool fAttachedToCanvas; 456 bool fAttachedToCanvas;
457 #endif 457 #endif
458 458
459 typedef SkRefCnt INHERITED; 459 typedef SkRefCnt INHERITED;
460 }; 460 };
461 461
462 #endif 462 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698