| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 { | 60 { |
| 61 // Clear the background transparent or opaque, as required. It would be nice
if this wasn't | 61 // Clear the background transparent or opaque, as required. It would be nice
if this wasn't |
| 62 // required, but the canvas is currently filled with the magic transparency | 62 // required, but the canvas is currently filled with the magic transparency |
| 63 // color. Can we have another way to manage this? | 63 // color. Can we have another way to manage this? |
| 64 if (isValid()) { | 64 if (isValid()) { |
| 65 if (m_opacityMode == Opaque) { | 65 if (m_opacityMode == Opaque) { |
| 66 canvas()->clear(SK_ColorBLACK); | 66 canvas()->clear(SK_ColorBLACK); |
| 67 } else { | 67 } else { |
| 68 canvas()->clear(SK_ColorTRANSPARENT); | 68 canvas()->clear(SK_ColorTRANSPARENT); |
| 69 } | 69 } |
| 70 didDraw(FloatRect(FloatPoint(0, 0), size())); | 70 didDraw(FloatRect(FloatPoint(0, 0), FloatSize(size()))); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 void ImageBufferSurface::draw(GraphicsContext* context, const FloatRect& destRec
t, const FloatRect& srcRect, SkXfermode::Mode op) | 74 void ImageBufferSurface::draw(GraphicsContext* context, const FloatRect& destRec
t, const FloatRect& srcRect, SkXfermode::Mode op) |
| 75 { | 75 { |
| 76 RefPtr<SkImage> snapshot = newImageSnapshot(PreferNoAcceleration); | 76 RefPtr<SkImage> snapshot = newImageSnapshot(PreferNoAcceleration); |
| 77 if (!snapshot) | 77 if (!snapshot) |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 RefPtr<Image> image = StaticBitmapImage::create(snapshot.release()); | 80 RefPtr<Image> image = StaticBitmapImage::create(snapshot.release()); |
| 81 context->drawImage(image.get(), destRect, srcRect, op); | 81 context->drawImage(image.get(), destRect, srcRect, op); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void ImageBufferSurface::flush() | 84 void ImageBufferSurface::flush() |
| 85 { | 85 { |
| 86 canvas()->flush(); | 86 canvas()->flush(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool ImageBufferSurface::writePixels(const SkImageInfo& origInfo, const void* pi
xels, size_t rowBytes, int x, int y) | 89 bool ImageBufferSurface::writePixels(const SkImageInfo& origInfo, const void* pi
xels, size_t rowBytes, int x, int y) |
| 90 { | 90 { |
| 91 return canvas()->writePixels(origInfo, pixels, rowBytes, x, y); | 91 return canvas()->writePixels(origInfo, pixels, rowBytes, x, y); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |