1 #define LOG_TAG "PicturePileLayerContent" 2 #define LOG_NDEBUG 1 3 4 #include "config.h" 5 #include "PicturePileLayerContent.h" 6 7 #include "AndroidLog.h" 8 #include "SkCanvas.h" 9 #include "SkPicture.h" 10 11 namespace WebCore { 12 PicturePileLayerContent(const PicturePile & picturePile)13PicturePileLayerContent::PicturePileLayerContent(const PicturePile& picturePile) 14 : m_picturePile(picturePile) 15 , m_maxZoomScale(picturePile.maxZoomScale()) 16 , m_hasContent(!picturePile.isEmpty()) 17 { 18 } 19 draw(SkCanvas * canvas)20void PicturePileLayerContent::draw(SkCanvas* canvas) 21 { 22 TRACE_METHOD(); 23 android::Mutex::Autolock lock(m_drawLock); 24 m_picturePile.draw(canvas); 25 26 if (CC_UNLIKELY(!m_hasContent)) 27 ALOGW("Warning: painting PicturePile without content!"); 28 } 29 serialize(SkWStream * stream)30void PicturePileLayerContent::serialize(SkWStream* stream) 31 { 32 if (!stream) 33 return; 34 SkPicture picture; 35 draw(picture.beginRecording(width(), height(), 36 SkPicture::kUsePathBoundsForClip_RecordingFlag)); 37 picture.endRecording(); 38 picture.serialize(stream); 39 } 40 prerenderForRect(const IntRect & dirty)41PrerenderedInval* PicturePileLayerContent::prerenderForRect(const IntRect& dirty) 42 { 43 return m_picturePile.prerenderedInvalForArea(dirty); 44 } 45 clearPrerenders()46void PicturePileLayerContent::clearPrerenders() 47 { 48 m_picturePile.clearPrerenders(); 49 } 50 51 } // namespace WebCore 52