Title: [146228] trunk/Source/WebCore
- Revision
- 146228
- Author
- [email protected]
- Date
- 2013-03-19 11:45:23 -0700 (Tue, 19 Mar 2013)
Log Message
Implement onRefEncodedData for lazy pixel refs.
This allows printToSkPicture to write the original
encoded data to the stream.
Add a method to ImageFrameGenerator to copy its
data, which is used by onRefEncodedData.
https://bugs.webkit.org/show_bug.cgi?id=110759
Patch by Leon Scroggins <[email protected]> on 2013-03-19
Reviewed by Stephen White.
No new tests. New functionality is for testing purposes
(creating SKP files).
* platform/graphics/chromium/ImageFrameGenerator.cpp:
(WebCore::ImageFrameGenerator::data):
(WebCore):
* platform/graphics/chromium/ImageFrameGenerator.h:
(ImageFrameGenerator):
* platform/graphics/chromium/LazyDecodingPixelRef.cpp:
(WebCore::LazyDecodingPixelRef::isClipped):
(WebCore):
(WebCore::LazyDecodingPixelRef::onRefEncodedData):
* platform/graphics/chromium/LazyDecodingPixelRef.h:
(LazyDecodingPixelRef):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (146227 => 146228)
--- trunk/Source/WebCore/ChangeLog 2013-03-19 18:39:18 UTC (rev 146227)
+++ trunk/Source/WebCore/ChangeLog 2013-03-19 18:45:23 UTC (rev 146228)
@@ -1,3 +1,29 @@
+2013-03-19 Leon Scroggins <[email protected]>
+
+ Implement onRefEncodedData for lazy pixel refs.
+ This allows printToSkPicture to write the original
+ encoded data to the stream.
+ Add a method to ImageFrameGenerator to copy its
+ data, which is used by onRefEncodedData.
+ https://bugs.webkit.org/show_bug.cgi?id=110759
+
+ Reviewed by Stephen White.
+
+ No new tests. New functionality is for testing purposes
+ (creating SKP files).
+
+ * platform/graphics/chromium/ImageFrameGenerator.cpp:
+ (WebCore::ImageFrameGenerator::data):
+ (WebCore):
+ * platform/graphics/chromium/ImageFrameGenerator.h:
+ (ImageFrameGenerator):
+ * platform/graphics/chromium/LazyDecodingPixelRef.cpp:
+ (WebCore::LazyDecodingPixelRef::isClipped):
+ (WebCore):
+ (WebCore::LazyDecodingPixelRef::onRefEncodedData):
+ * platform/graphics/chromium/LazyDecodingPixelRef.h:
+ (LazyDecodingPixelRef):
+
2013-03-19 Philip Rogers <[email protected]>
Separate SVG image size and container size
Modified: trunk/Source/WebCore/platform/graphics/chromium/ImageFrameGenerator.cpp (146227 => 146228)
--- trunk/Source/WebCore/platform/graphics/chromium/ImageFrameGenerator.cpp 2013-03-19 18:39:18 UTC (rev 146227)
+++ trunk/Source/WebCore/platform/graphics/chromium/ImageFrameGenerator.cpp 2013-03-19 18:45:23 UTC (rev 146228)
@@ -69,6 +69,14 @@
m_data.setData(data.get(), allDataReceived);
}
+void ImageFrameGenerator::copyData(RefPtr<SharedBuffer>* data, bool* allDataReceived)
+{
+ SharedBuffer* buffer = 0;
+ m_data.data(&buffer, allDataReceived);
+ if (buffer)
+ *data = ""
+}
+
const ScaledImageFragment* ImageFrameGenerator::decodeAndScale(const SkISize& scaledSize)
{
// Prevents concurrent decode or scale operations on the same image data.
Modified: trunk/Source/WebCore/platform/graphics/chromium/ImageFrameGenerator.h (146227 => 146228)
--- trunk/Source/WebCore/platform/graphics/chromium/ImageFrameGenerator.h 2013-03-19 18:39:18 UTC (rev 146227)
+++ trunk/Source/WebCore/platform/graphics/chromium/ImageFrameGenerator.h 2013-03-19 18:45:23 UTC (rev 146228)
@@ -65,6 +65,9 @@
void setData(PassRefPtr<SharedBuffer>, bool allDataReceived);
+ // Creates a new SharedBuffer containing the data received so far.
+ void copyData(RefPtr<SharedBuffer>*, bool* allDataReceived);
+
void setImageDecoderFactoryForTesting(PassOwnPtr<ImageDecoderFactory> factory) { m_imageDecoderFactory = factory; }
bool hasAlpha();
Modified: trunk/Source/WebCore/platform/graphics/chromium/LazyDecodingPixelRef.cpp (146227 => 146228)
--- trunk/Source/WebCore/platform/graphics/chromium/LazyDecodingPixelRef.cpp 2013-03-19 18:39:18 UTC (rev 146227)
+++ trunk/Source/WebCore/platform/graphics/chromium/LazyDecodingPixelRef.cpp 2013-03-19 18:45:23 UTC (rev 146228)
@@ -29,6 +29,7 @@
#include "ImageDecoder.h"
#include "ImageDecodingStore.h"
#include "ImageFrameGenerator.h"
+#include "SkData.h"
#include "TraceEvent.h"
#include <wtf/MainThread.h>
@@ -56,6 +57,18 @@
return m_scaledSize.width() != m_scaledSubset.width() || m_scaledSize.height() != m_scaledSubset.height();
}
+SkData* LazyDecodingPixelRef::onRefEncodedData()
+{
+ RefPtr<SharedBuffer> buffer = 0;
+ bool allDataReceived = false;
+ m_frameGenerator->copyData(&buffer, &allDataReceived);
+ if (buffer && allDataReceived) {
+ SkData* skdata = SkData::NewWithCopy((void*)buffer->data(), buffer->size());
+ return skdata;
+ }
+ return 0;
+}
+
void* LazyDecodingPixelRef::onLockPixels(SkColorTable**)
{
TRACE_EVENT_ASYNC_BEGIN0("webkit", "LazyDecodingPixelRef::lockPixels", this);
Modified: trunk/Source/WebCore/platform/graphics/chromium/LazyDecodingPixelRef.h (146227 => 146228)
--- trunk/Source/WebCore/platform/graphics/chromium/LazyDecodingPixelRef.h 2013-03-19 18:39:18 UTC (rev 146227)
+++ trunk/Source/WebCore/platform/graphics/chromium/LazyDecodingPixelRef.h 2013-03-19 18:45:23 UTC (rev 146228)
@@ -38,6 +38,8 @@
using skia::LazyPixelRef;
+class SkData;
+
namespace WebCore {
class ImageFrameGenerator;
@@ -63,6 +65,8 @@
virtual void onUnlockPixels();
virtual bool onLockPixelsAreWritable() const;
+ virtual SkData* onRefEncodedData() SK_OVERRIDE;
+
private:
RefPtr<ImageFrameGenerator> m_frameGenerator;
SkISize m_scaledSize;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes