OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 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 SkDevice_DEFINED | 8 #ifndef SkDevice_DEFINED |
9 #define SkDevice_DEFINED | 9 #define SkDevice_DEFINED |
10 | 10 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 * if all rendering has been done. If false is returned, SkCanvas will | 333 * if all rendering has been done. If false is returned, SkCanvas will |
334 * perform its own rendering pass. It is acceptable for the backend | 334 * perform its own rendering pass. It is acceptable for the backend |
335 * to perform some device-specific warm up tasks and then let SkCanvas | 335 * to perform some device-specific warm up tasks and then let SkCanvas |
336 * perform the main rendering loop (by return false from here). | 336 * perform the main rendering loop (by return false from here). |
337 */ | 337 */ |
338 virtual bool EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const SkM
atrix*, | 338 virtual bool EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const SkM
atrix*, |
339 const SkPaint*); | 339 const SkPaint*); |
340 | 340 |
341 void setPixelGeometry(SkPixelGeometry geo); | 341 void setPixelGeometry(SkPixelGeometry geo); |
342 | 342 |
| 343 struct CreateInfo { |
| 344 CreateInfo(const SkImageInfo& info, Usage usage) : fInfo(info), fUsage(u
sage) {} |
| 345 |
| 346 SkImageInfo fInfo; |
| 347 Usage fUsage; |
| 348 }; |
| 349 virtual SkBaseDevice* onCreateCompatibleDevice(const CreateInfo& cinfo) { |
| 350 // call deprecated method until we can update chrome's subclasses |
| 351 return this->onCreateDevice(cinfo.fInfo, cinfo.fUsage); |
| 352 } |
| 353 |
343 private: | 354 private: |
344 friend class SkCanvas; | 355 friend class SkCanvas; |
345 friend struct DeviceCM; //for setMatrixClip | 356 friend struct DeviceCM; //for setMatrixClip |
346 friend class SkDraw; | 357 friend class SkDraw; |
347 friend class SkDrawIter; | 358 friend class SkDrawIter; |
348 friend class SkDeviceFilteredPaint; | 359 friend class SkDeviceFilteredPaint; |
349 friend class SkDeviceImageFilterProxy; | 360 friend class SkDeviceImageFilterProxy; |
350 friend class SkDeferredDevice; // for newSurface | 361 friend class SkDeferredDevice; // for newSurface |
351 | 362 |
352 friend class SkSurface_Raster; | 363 friend class SkSurface_Raster; |
353 | 364 |
354 // used to change the backend's pixels (and possibly config/rowbytes) | 365 // used to change the backend's pixels (and possibly config/rowbytes) |
355 // but cannot change the width/height, so there should be no change to | 366 // but cannot change the width/height, so there should be no change to |
356 // any clip information. | 367 // any clip information. |
357 // TODO: move to SkBitmapDevice | 368 // TODO: move to SkBitmapDevice |
358 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} | 369 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} |
359 | 370 |
360 virtual bool forceConservativeRasterClip() const { return false; } | 371 virtual bool forceConservativeRasterClip() const { return false; } |
361 | 372 |
362 // just called by SkCanvas when built as a layer | 373 // just called by SkCanvas when built as a layer |
363 void setOrigin(int x, int y) { fOrigin.set(x, y); } | 374 void setOrigin(int x, int y) { fOrigin.set(x, y); } |
364 // just called by SkCanvas for saveLayer | 375 // just called by SkCanvas for saveLayer |
365 SkBaseDevice* createCompatibleDeviceForSaveLayer(const SkImageInfo&); | 376 SkBaseDevice* createCompatibleDeviceForSaveLayer(const SkImageInfo&); |
366 // just called by SkCanvas for imagefilter | 377 // just called by SkCanvas for imagefilter |
367 SkBaseDevice* createCompatibleDeviceForImageFilter(const SkImageInfo&); | 378 SkBaseDevice* createCompatibleDeviceForImageFilter(const SkImageInfo&); |
368 | 379 |
| 380 // DEPRECATED -- override onCreateCompatibleDevice instead. |
369 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) { | 381 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) { |
370 return NULL; | 382 return NULL; |
371 } | 383 } |
372 | 384 |
373 /** Causes any deferred drawing to the device to be completed. | 385 /** Causes any deferred drawing to the device to be completed. |
374 */ | 386 */ |
375 virtual void flush() {} | 387 virtual void flush() {} |
376 | 388 |
377 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } | 389 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } |
378 | 390 |
379 SkIPoint fOrigin; | 391 SkIPoint fOrigin; |
380 SkMetaData* fMetaData; | 392 SkMetaData* fMetaData; |
381 SkDeviceProperties* fLeakyProperties; // will always exist. | 393 SkDeviceProperties* fLeakyProperties; // will always exist. |
382 | 394 |
383 #ifdef SK_DEBUG | 395 #ifdef SK_DEBUG |
384 bool fAttachedToCanvas; | 396 bool fAttachedToCanvas; |
385 #endif | 397 #endif |
386 | 398 |
387 typedef SkRefCnt INHERITED; | 399 typedef SkRefCnt INHERITED; |
388 }; | 400 }; |
389 | 401 |
390 #endif | 402 #endif |
OLD | NEW |