From 682a85cb3ff0b200d4fe0f7ef41a4e1c57dea233 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 14 Aug 2012 16:53:39 -0700 Subject: Move text allocations to LinearAllocator Change-Id: I3ef492679e94bdb452033ee3af3162b88d323d57 --- .../android/context/PlatformGraphicsContextRecording.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp') diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp index 24ee47e..464224a 100644 --- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp +++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp @@ -891,15 +891,20 @@ void PlatformGraphicsContextRecording::strokeRect(const FloatRect& rect, float l appendDrawingOperation(NEW_OP(StrokeRect)(rect, lineWidth), bounds); } -void PlatformGraphicsContextRecording::drawPosText(const void* text, size_t byteLength, - const SkPoint pos[], const SkPaint& inPaint) +void PlatformGraphicsContextRecording::drawPosText(const void* inText, size_t byteLength, + const SkPoint inPos[], const SkPaint& inPaint) { if (inPaint.getTextEncoding() != SkPaint::kGlyphID_TextEncoding) { ALOGE("Unsupported text encoding! %d", inPaint.getTextEncoding()); return; } - FloatRect bounds = approximateTextBounds(byteLength / sizeof(uint16_t), pos, inPaint); + FloatRect bounds = approximateTextBounds(byteLength / sizeof(uint16_t), inPos, inPaint); const SkPaint* paint = mRecording->recording()->getSkPaint(inPaint); + int posSize = sizeof(SkPoint) * paint->countText(inText, byteLength); + void* text = operationHeap()->alloc(posSize + byteLength); + SkPoint* pos = (SkPoint*) ((char*)text + byteLength); + memcpy(text, inText, byteLength); + memcpy(pos, inPos, posSize); appendDrawingOperation(NEW_OP(DrawPosText)(text, byteLength, pos, paint), bounds); } -- cgit v1.1