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

Side by Side Diff: cc/BitmapCanvasLayerTextureUpdater.cpp

Issue 11122003: [cc] Rename all cc/ filenames to Chromium style (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months 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
« no previous file with comments | « cc/BitmapCanvasLayerTextureUpdater.h ('k') | cc/BitmapSkPictureCanvasLayerTextureUpdater.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5
6 #include "config.h"
7
8 #if USE(ACCELERATED_COMPOSITING)
9
10 #include "BitmapCanvasLayerTextureUpdater.h"
11
12 #include "LayerPainterChromium.h"
13 #include "PlatformColor.h"
14 #include "skia/ext/platform_canvas.h"
15
16 namespace cc {
17
18 BitmapCanvasLayerTextureUpdater::Texture::Texture(BitmapCanvasLayerTextureUpdate r* textureUpdater, scoped_ptr<CCPrioritizedTexture> texture)
19 : LayerTextureUpdater::Texture(texture.Pass())
20 , m_textureUpdater(textureUpdater)
21 {
22 }
23
24 BitmapCanvasLayerTextureUpdater::Texture::~Texture()
25 {
26 }
27
28 void BitmapCanvasLayerTextureUpdater::Texture::updateRect(CCResourceProvider* re sourceProvider, const IntRect& sourceRect, const IntSize& destOffset)
29 {
30 textureUpdater()->updateTextureRect(resourceProvider, texture(), sourceRect, destOffset);
31 }
32
33 PassRefPtr<BitmapCanvasLayerTextureUpdater> BitmapCanvasLayerTextureUpdater::cre ate(PassOwnPtr<LayerPainterChromium> painter)
34 {
35 return adoptRef(new BitmapCanvasLayerTextureUpdater(painter));
36 }
37
38 BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater(PassOwnPtr<Laye rPainterChromium> painter)
39 : CanvasLayerTextureUpdater(painter)
40 , m_opaque(false)
41 {
42 }
43
44 BitmapCanvasLayerTextureUpdater::~BitmapCanvasLayerTextureUpdater()
45 {
46 }
47
48 PassOwnPtr<LayerTextureUpdater::Texture> BitmapCanvasLayerTextureUpdater::create Texture(CCPrioritizedTextureManager* manager)
49 {
50 return adoptPtr(new Texture(this, CCPrioritizedTexture::create(manager)));
51 }
52
53 LayerTextureUpdater::SampledTexelFormat BitmapCanvasLayerTextureUpdater::sampled TexelFormat(GC3Denum textureFormat)
54 {
55 // The component order may be bgra if we uploaded bgra pixels to rgba textur es.
56 return PlatformColor::sameComponentOrder(textureFormat) ?
57 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::S ampledTexelFormatBGRA;
58 }
59
60 void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect , const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats& stats)
61 {
62 if (m_canvasSize != contentRect.size()) {
63 m_canvasSize = contentRect.size();
64 m_canvas = adoptPtr(skia::CreateBitmapCanvas(m_canvasSize.width(), m_can vasSize.height(), m_opaque));
65 }
66
67 paintContents(m_canvas.get(), contentRect, contentsWidthScale, contentsHeigh tScale, resultingOpaqueRect, stats);
68 }
69
70 void BitmapCanvasLayerTextureUpdater::updateTextureRect(CCResourceProvider* reso urceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const In tSize& destOffset)
71 {
72 const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(false);
73 bitmap.lockPixels();
74
75 texture->upload(resourceProvider, static_cast<const uint8_t*>(bitmap.getPixe ls()), contentRect(), sourceRect, destOffset);
76 bitmap.unlockPixels();
77 }
78
79 void BitmapCanvasLayerTextureUpdater::setOpaque(bool opaque)
80 {
81 if (opaque != m_opaque) {
82 m_canvas.clear();
83 m_canvasSize = IntSize();
84 }
85 m_opaque = opaque;
86 }
87
88 } // namespace cc
89 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/BitmapCanvasLayerTextureUpdater.h ('k') | cc/BitmapSkPictureCanvasLayerTextureUpdater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698