OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 #ifndef SkCanvas_DEFINED | 8 #ifndef SkCanvas_DEFINED |
9 #define SkCanvas_DEFINED | 9 #define SkCanvas_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
13 #include "SkDeque.h" | 13 #include "SkDeque.h" |
14 #include "SkClipStack.h" | 14 #include "SkClipStack.h" |
15 #include "SkPaint.h" | 15 #include "SkPaint.h" |
16 #include "SkRefCnt.h" | 16 #include "SkRefCnt.h" |
17 #include "SkPath.h" | 17 #include "SkPath.h" |
18 #include "SkRegion.h" | 18 #include "SkRegion.h" |
19 #include "SkXfermode.h" | 19 #include "SkXfermode.h" |
20 | 20 |
21 // if not defined, we always assume ClipToLayer for saveLayer() | 21 // if not defined, we always assume ClipToLayer for saveLayer() |
22 //#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG | 22 //#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG |
23 | 23 |
24 | 24 |
25 //#define SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG | |
26 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE | 25 //#define SK_SUPPORT_LEGACY_GETCLIPTYPE |
27 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP | 26 //#define SK_SUPPORT_LEGACY_GETTOTALCLIP |
28 //#define SK_SUPPORT_LEGACY_GETTOPDEVICE | 27 //#define SK_SUPPORT_LEGACY_GETTOPDEVICE |
29 | 28 |
30 class SkBounder; | 29 class SkBounder; |
31 class SkBaseDevice; | 30 class SkBaseDevice; |
32 class SkDraw; | 31 class SkDraw; |
33 class SkDrawFilter; | 32 class SkDrawFilter; |
34 class SkMetaData; | 33 class SkMetaData; |
35 class SkPicture; | 34 class SkPicture; |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 Config8888 config8888 = kNative_Premul_Config8888); | 305 Config8888 config8888 = kNative_Premul_Config8888); |
307 | 306 |
308 /** | 307 /** |
309 * DEPRECATED: This will be removed as soon as webkit is no longer relying | 308 * DEPRECATED: This will be removed as soon as webkit is no longer relying |
310 * on it. The bitmap is resized to the intersection of srcRect and the | 309 * on it. The bitmap is resized to the intersection of srcRect and the |
311 * canvas bounds. New pixels are always allocated on success. Bitmap is | 310 * canvas bounds. New pixels are always allocated on success. Bitmap is |
312 * unmodified on failure. | 311 * unmodified on failure. |
313 */ | 312 */ |
314 bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap); | 313 bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap); |
315 | 314 |
316 #ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG | |
317 /** | |
318 * DEPRECATED | |
319 * Similar to draw sprite, this method will copy the pixels in bitmap onto | |
320 * the canvas, with the top/left corner specified by (x, y). The canvas' | |
321 * pixel values are completely replaced: there is no blending. | |
322 * | |
323 * Currently if bitmap is backed by a texture this is a no-op. This may be | |
324 * relaxed in the future. | |
325 * | |
326 * If the bitmap has config kARGB_8888_Config then the config8888 param | |
327 * will determines how the pixel valuess are intepreted. If the bitmap is | |
328 * not kARGB_8888_Config then this parameter is ignored. | |
329 * | |
330 * Note: If you are recording drawing commands on this canvas to | |
331 * SkPicture, writePixels() is ignored! | |
332 */ | |
333 void writePixels(const SkBitmap& bitmap, int x, int y, Config8888 config8888
); | |
334 #endif | |
335 | |
336 /** | 315 /** |
337 * This method affects the pixels in the base-layer, and operates in pixel
coordinates, | 316 * This method affects the pixels in the base-layer, and operates in pixel
coordinates, |
338 * ignoring the matrix and clip. | 317 * ignoring the matrix and clip. |
339 * | 318 * |
340 * The specified ImageInfo and (x,y) offset specifies a rectangle: target. | 319 * The specified ImageInfo and (x,y) offset specifies a rectangle: target. |
341 * | 320 * |
342 * target.setXYWH(x, y, info.width(), info.height()); | 321 * target.setXYWH(x, y, info.width(), info.height()); |
343 * | 322 * |
344 * Target is intersected with the bounds of the base-layer. If this interse
ction is not empty, | 323 * Target is intersected with the bounds of the base-layer. If this interse
ction is not empty, |
345 * then we have two sets of pixels (of equal size), the "src" specified by
info+pixels+rowBytes | 324 * then we have two sets of pixels (of equal size), the "src" specified by
info+pixels+rowBytes |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 bool asROBitmap(SkBitmap*) const; | 1473 bool asROBitmap(SkBitmap*) const; |
1495 | 1474 |
1496 private: | 1475 private: |
1497 SkBitmap fBitmap; // used if peekPixels() fails | 1476 SkBitmap fBitmap; // used if peekPixels() fails |
1498 const void* fAddr; // NULL on failure | 1477 const void* fAddr; // NULL on failure |
1499 SkImageInfo fInfo; | 1478 SkImageInfo fInfo; |
1500 size_t fRowBytes; | 1479 size_t fRowBytes; |
1501 }; | 1480 }; |
1502 | 1481 |
1503 #endif | 1482 #endif |
OLD | NEW |