Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(846)

Side by Side Diff: Source/core/platform/graphics/CrossfadeGeneratedImage.cpp

Issue 104023007: Refactoring ImageBuffer to decouple it from Canvas2DLayerBridge (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: build fixes for win+mac Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 context->translate(dstRect.x(), dstRect.y()); 88 context->translate(dstRect.x(), dstRect.y());
89 if (dstRect.size() != srcRect.size()) 89 if (dstRect.size() != srcRect.size())
90 context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.heig ht() / srcRect.height())); 90 context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.heig ht() / srcRect.height()));
91 context->translate(-srcRect.x(), -srcRect.y()); 91 context->translate(-srcRect.x(), -srcRect.y());
92 92
93 drawCrossfade(context); 93 drawCrossfade(context);
94 } 94 }
95 95
96 void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatR ect& srcRect, const FloatSize& scale, const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, blink::WebBlendMode blendMode, const Int Size& repeatSpacing) 96 void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatR ect& srcRect, const FloatSize& scale, const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, blink::WebBlendMode blendMode, const Int Size& repeatSpacing)
97 { 97 {
98 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(m_size, 1, context->is Accelerated() ? Accelerated : Unaccelerated); 98 OwnPtr<ImageBuffer> imageBuffer = context->createCompatibleBuffer(m_size);
99 if (!imageBuffer) 99 if (!imageBuffer)
100 return; 100 return;
101 101
102 // Fill with the cross-faded image. 102 // Fill with the cross-faded image.
103 GraphicsContext* graphicsContext = imageBuffer->context(); 103 GraphicsContext* graphicsContext = imageBuffer->context();
104 drawCrossfade(graphicsContext); 104 drawCrossfade(graphicsContext);
105 105
106 // Tile the image buffer into the context. 106 // Tile the image buffer into the context.
107 imageBuffer->drawPattern(context, srcRect, scale, phase, compositeOp, dstRec t, blendMode, repeatSpacing); 107 imageBuffer->drawPattern(context, srcRect, scale, phase, compositeOp, dstRec t, blendMode, repeatSpacing);
108 } 108 }
109 109
110 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698