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 | |
354 private: | 343 private: |
355 friend class SkCanvas; | 344 friend class SkCanvas; |
356 friend struct DeviceCM; //for setMatrixClip | 345 friend struct DeviceCM; //for setMatrixClip |
357 friend class SkDraw; | 346 friend class SkDraw; |
358 friend class SkDrawIter; | 347 friend class SkDrawIter; |
359 friend class SkDeviceFilteredPaint; | 348 friend class SkDeviceFilteredPaint; |
360 friend class SkDeviceImageFilterProxy; | 349 friend class SkDeviceImageFilterProxy; |
361 friend class SkDeferredDevice; // for newSurface | 350 friend class SkDeferredDevice; // for newSurface |
362 | 351 |
363 friend class SkSurface_Raster; | 352 friend class SkSurface_Raster; |
364 | 353 |
365 // used to change the backend's pixels (and possibly config/rowbytes) | 354 // used to change the backend's pixels (and possibly config/rowbytes) |
366 // but cannot change the width/height, so there should be no change to | 355 // but cannot change the width/height, so there should be no change to |
367 // any clip information. | 356 // any clip information. |
368 // TODO: move to SkBitmapDevice | 357 // TODO: move to SkBitmapDevice |
369 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} | 358 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} |
370 | 359 |
371 virtual bool forceConservativeRasterClip() const { return false; } | 360 virtual bool forceConservativeRasterClip() const { return false; } |
372 | 361 |
373 // just called by SkCanvas when built as a layer | 362 // just called by SkCanvas when built as a layer |
374 void setOrigin(int x, int y) { fOrigin.set(x, y); } | 363 void setOrigin(int x, int y) { fOrigin.set(x, y); } |
375 // just called by SkCanvas for saveLayer | 364 // just called by SkCanvas for saveLayer |
376 SkBaseDevice* createCompatibleDeviceForSaveLayer(const SkImageInfo&); | 365 SkBaseDevice* createCompatibleDeviceForSaveLayer(const SkImageInfo&); |
377 // just called by SkCanvas for imagefilter | 366 // just called by SkCanvas for imagefilter |
378 SkBaseDevice* createCompatibleDeviceForImageFilter(const SkImageInfo&); | 367 SkBaseDevice* createCompatibleDeviceForImageFilter(const SkImageInfo&); |
379 | 368 |
380 // DEPRECATED -- override onCreateCompatibleDevice instead. | |
381 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) { | 369 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) { |
382 return NULL; | 370 return NULL; |
383 } | 371 } |
384 | 372 |
385 /** Causes any deferred drawing to the device to be completed. | 373 /** Causes any deferred drawing to the device to be completed. |
386 */ | 374 */ |
387 virtual void flush() {} | 375 virtual void flush() {} |
388 | 376 |
389 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } | 377 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } |
390 | 378 |
391 SkIPoint fOrigin; | 379 SkIPoint fOrigin; |
392 SkMetaData* fMetaData; | 380 SkMetaData* fMetaData; |
393 SkDeviceProperties* fLeakyProperties; // will always exist. | 381 SkDeviceProperties* fLeakyProperties; // will always exist. |
394 | 382 |
395 #ifdef SK_DEBUG | 383 #ifdef SK_DEBUG |
396 bool fAttachedToCanvas; | 384 bool fAttachedToCanvas; |
397 #endif | 385 #endif |
398 | 386 |
399 typedef SkRefCnt INHERITED; | 387 typedef SkRefCnt INHERITED; |
400 }; | 388 }; |
401 | 389 |
402 #endif | 390 #endif |
OLD | NEW |