OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
8 * met: | 8 * met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 { | 251 { |
252 context->beginLayerClippedToImage(rect, this); | 252 context->beginLayerClippedToImage(rect, this); |
253 } | 253 } |
254 | 254 |
255 static bool drawNeedsCopy(GraphicsContext* src, GraphicsContext* dst) | 255 static bool drawNeedsCopy(GraphicsContext* src, GraphicsContext* dst) |
256 { | 256 { |
257 return (src == dst); | 257 return (src == dst); |
258 } | 258 } |
259 | 259 |
260 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, con
st FloatRect& destRect, const FloatRect& srcRect, | 260 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, con
st FloatRect& destRect, const FloatRect& srcRect, |
261 CompositeOperator op, BlendMode, bool useLowQualityScale) | 261 CompositeOperator op, BlendMode blendMode, bool useLowQualityScale) |
262 { | 262 { |
263 const SkBitmap& bitmap = *m_context->bitmap(); | 263 const SkBitmap& bitmap = *m_context->bitmap(); |
264 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC
opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); | 264 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC
opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); |
265 context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, DoNo
tRespectImageOrientation, useLowQualityScale); | 265 context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, blen
dMode, DoNotRespectImageOrientation, useLowQualityScale); |
266 } | 266 } |
267 | 267 |
268 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect
, const AffineTransform& patternTransform, | 268 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect
, const AffineTransform& patternTransform, |
269 const FloatPoint& phase, ColorSpace styleColorSpac
e, CompositeOperator op, const FloatRect& destRect) | 269 const FloatPoint& phase, ColorSpace styleColorSpac
e, CompositeOperator op, const FloatRect& destRect) |
270 { | 270 { |
271 const SkBitmap& bitmap = *m_context->bitmap(); | 271 const SkBitmap& bitmap = *m_context->bitmap(); |
272 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC
opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); | 272 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC
opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); |
273 image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpac
e, op, destRect); | 273 image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpac
e, op, destRect); |
274 } | 274 } |
275 | 275 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) | 436 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) |
437 return "data:,"; | 437 return "data:,"; |
438 | 438 |
439 Vector<char> base64Data; | 439 Vector<char> base64Data; |
440 base64Encode(encodedImage, base64Data); | 440 base64Encode(encodedImage, base64Data); |
441 | 441 |
442 return "data:" + mimeType + ";base64," + base64Data; | 442 return "data:" + mimeType + ";base64," + base64Data; |
443 } | 443 } |
444 | 444 |
445 } // namespace WebCore | 445 } // namespace WebCore |
OLD | NEW |