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

Side by Side Diff: cc/texture_uploader.h

Issue 11266030: Use gfx:: Geometry types for the resource provider and layer updater classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: uint8 Created 8 years, 1 month 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/texture.cc ('k') | cc/texture_uploader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_TEXTURE_UPLOADER_H_ 5 #ifndef CC_TEXTURE_UPLOADER_H_
6 #define CC_TEXTURE_UPLOADER_H_ 6 #define CC_TEXTURE_UPLOADER_H_
7 7
8 #include "IntRect.h"
9 #include "base/basictypes.h" 8 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
11 #include "cc/scoped_ptr_deque.h" 10 #include "cc/scoped_ptr_deque.h"
12 #include <set> 11 #include <set>
13 #include "third_party/khronos/GLES2/gl2.h" 12 #include "third_party/khronos/GLES2/gl2.h"
14 13
15 namespace WebKit { 14 namespace WebKit {
16 class WebGraphicsContext3D; 15 class WebGraphicsContext3D;
17 } 16 }
18 17
18 namespace gfx {
19 class Rect;
20 class Size;
21 class Vector2d;
22 }
23
19 namespace cc { 24 namespace cc {
20 25
21 class TextureUploader { 26 class TextureUploader {
22 public: 27 public:
23 static scoped_ptr<TextureUploader> create( 28 static scoped_ptr<TextureUploader> create(
24 WebKit::WebGraphicsContext3D* context, bool useMapTexSubImage) 29 WebKit::WebGraphicsContext3D* context, bool useMapTexSubImage)
25 { 30 {
26 return make_scoped_ptr(new TextureUploader(context, useMapTexSubImage)); 31 return make_scoped_ptr(new TextureUploader(context, useMapTexSubImage));
27 } 32 }
28 ~TextureUploader(); 33 ~TextureUploader();
29 34
30 size_t numBlockingUploads(); 35 size_t numBlockingUploads();
31 void markPendingUploadsAsNonBlocking(); 36 void markPendingUploadsAsNonBlocking();
32 double estimatedTexturesPerSecond(); 37 double estimatedTexturesPerSecond();
33 38
34 // Let imageRect be a rectangle, and let sourceRect be a sub-rectangle of 39 // Let imageRect be a rectangle, and let sourceRect be a sub-rectangle of
35 // imageRect, expressed in the same coordinate system as imageRect. Let 40 // imageRect, expressed in the same coordinate system as imageRect. Let
36 // image be a buffer for imageRect. This function will copy the region 41 // image be a buffer for imageRect. This function will copy the region
37 // corresponding to sourceRect to destOffset in this sub-image. 42 // corresponding to sourceRect to destOffset in this sub-image.
38 void upload(const uint8_t* image, 43 void upload(const uint8* image,
39 const IntRect& content_rect, 44 const gfx::Rect& content_rect,
40 const IntRect& source_rect, 45 const gfx::Rect& source_rect,
41 const IntSize& dest_offset, 46 const gfx::Vector2d& dest_offset,
42 GLenum format, 47 GLenum format,
43 IntSize size); 48 const gfx::Size& size);
44 49
45 private: 50 private:
46 class Query { 51 class Query {
47 public: 52 public:
48 static scoped_ptr<Query> create(WebKit::WebGraphicsContext3D* context) { return make_scoped_ptr(new Query(context)); } 53 static scoped_ptr<Query> create(WebKit::WebGraphicsContext3D* context) { return make_scoped_ptr(new Query(context)); }
49 54
50 virtual ~Query(); 55 virtual ~Query();
51 56
52 void begin(); 57 void begin();
53 void end(); 58 void end();
(...skipping 12 matching lines...) Expand all
66 bool m_hasValue; 71 bool m_hasValue;
67 bool m_isNonBlocking; 72 bool m_isNonBlocking;
68 }; 73 };
69 74
70 TextureUploader(WebKit::WebGraphicsContext3D*, bool useMapTexSubImage); 75 TextureUploader(WebKit::WebGraphicsContext3D*, bool useMapTexSubImage);
71 76
72 void beginQuery(); 77 void beginQuery();
73 void endQuery(); 78 void endQuery();
74 void processQueries(); 79 void processQueries();
75 80
76 void uploadWithTexSubImage(const uint8_t* image, 81 void uploadWithTexSubImage(const uint8* image,
77 const IntRect& image_rect, 82 const gfx::Rect& image_rect,
78 const IntRect& source_rect, 83 const gfx::Rect& source_rect,
79 const IntSize& dest_offset, 84 const gfx::Vector2d& dest_offset,
80 GLenum format); 85 GLenum format);
81 void uploadWithMapTexSubImage(const uint8_t* image, 86 void uploadWithMapTexSubImage(const uint8* image,
82 const IntRect& image_rect, 87 const gfx::Rect& image_rect,
83 const IntRect& source_rect, 88 const gfx::Rect& source_rect,
84 const IntSize& dest_offset, 89 const gfx::Vector2d& dest_offset,
85 GLenum format); 90 GLenum format);
86 91
87 WebKit::WebGraphicsContext3D* m_context; 92 WebKit::WebGraphicsContext3D* m_context;
88 ScopedPtrDeque<Query> m_pendingQueries; 93 ScopedPtrDeque<Query> m_pendingQueries;
89 ScopedPtrDeque<Query> m_availableQueries; 94 ScopedPtrDeque<Query> m_availableQueries;
90 std::multiset<double> m_texturesPerSecondHistory; 95 std::multiset<double> m_texturesPerSecondHistory;
91 size_t m_numBlockingTextureUploads; 96 size_t m_numBlockingTextureUploads;
92 97
93 bool m_useMapTexSubImage; 98 bool m_useMapTexSubImage;
94 size_t m_subImageSize; 99 size_t m_subImageSize;
95 scoped_array<uint8_t> m_subImage; 100 scoped_array<uint8> m_subImage;
96 101
97 DISALLOW_COPY_AND_ASSIGN(TextureUploader); 102 DISALLOW_COPY_AND_ASSIGN(TextureUploader);
98 }; 103 };
99 104
100 } // namespace cc 105 } // namespace cc
101 106
102 #endif // CC_TEXTURE_UPLOADER_H_ 107 #endif // CC_TEXTURE_UPLOADER_H_
OLDNEW
« no previous file with comments | « cc/texture.cc ('k') | cc/texture_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698