| OLD | NEW | 
|    1 // Copyright 2014 The Chromium Authors. All rights reserved. |    1 // Copyright 2014 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_RESOURCES_TEXTURE_UPLOADER_H_ |    5 #ifndef CC_RESOURCES_TEXTURE_UPLOADER_H_ | 
|    6 #define CC_RESOURCES_TEXTURE_UPLOADER_H_ |    6 #define CC_RESOURCES_TEXTURE_UPLOADER_H_ | 
|    7  |    7  | 
|    8 #include <set> |    8 #include <set> | 
|    9  |    9  | 
|   10 #include "base/basictypes.h" |   10 #include "base/basictypes.h" | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
|   38   void MarkPendingUploadsAsNonBlocking(); |   38   void MarkPendingUploadsAsNonBlocking(); | 
|   39   double EstimatedTexturesPerSecond(); |   39   double EstimatedTexturesPerSecond(); | 
|   40  |   40  | 
|   41   // Let content_rect be a rectangle, and let content_rect be a sub-rectangle of |   41   // Let content_rect be a rectangle, and let content_rect be a sub-rectangle of | 
|   42   // content_rect, expressed in the same coordinate system as content_rect. Let |   42   // content_rect, expressed in the same coordinate system as content_rect. Let | 
|   43   // image be a buffer for content_rect. This function will copy the region |   43   // image be a buffer for content_rect. This function will copy the region | 
|   44   // corresponding to source_rect to dest_offset in this sub-image. |   44   // corresponding to source_rect to dest_offset in this sub-image. | 
|   45   void Upload(const uint8* image, |   45   void Upload(const uint8* image, | 
|   46               const gfx::Rect& content_rect, |   46               const gfx::Rect& content_rect, | 
|   47               const gfx::Rect& source_rect, |   47               const gfx::Rect& source_rect, | 
|   48               gfx::Vector2d dest_offset, |   48               const gfx::Vector2d& dest_offset, | 
|   49               ResourceFormat format, |   49               ResourceFormat format, | 
|   50               const gfx::Size& size); |   50               const gfx::Size& size); | 
|   51  |   51  | 
|   52   void Flush(); |   52   void Flush(); | 
|   53   void ReleaseCachedQueries(); |   53   void ReleaseCachedQueries(); | 
|   54  |   54  | 
|   55  private: |   55  private: | 
|   56   class Query { |   56   class Query { | 
|   57    public: |   57    public: | 
|   58     static scoped_ptr<Query> Create(gpu::gles2::GLES2Interface* gl) { |   58     static scoped_ptr<Query> Create(gpu::gles2::GLES2Interface* gl) { | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
|   83  |   83  | 
|   84   explicit TextureUploader(gpu::gles2::GLES2Interface* gl); |   84   explicit TextureUploader(gpu::gles2::GLES2Interface* gl); | 
|   85  |   85  | 
|   86   void BeginQuery(); |   86   void BeginQuery(); | 
|   87   void EndQuery(); |   87   void EndQuery(); | 
|   88   void ProcessQueries(); |   88   void ProcessQueries(); | 
|   89  |   89  | 
|   90   void UploadWithTexSubImage(const uint8* image, |   90   void UploadWithTexSubImage(const uint8* image, | 
|   91                              const gfx::Rect& image_rect, |   91                              const gfx::Rect& image_rect, | 
|   92                              const gfx::Rect& source_rect, |   92                              const gfx::Rect& source_rect, | 
|   93                              gfx::Vector2d dest_offset, |   93                              const gfx::Vector2d& dest_offset, | 
|   94                              ResourceFormat format); |   94                              ResourceFormat format); | 
|   95   void UploadWithMapTexSubImage(const uint8* image, |   95   void UploadWithMapTexSubImage(const uint8* image, | 
|   96                                 const gfx::Rect& image_rect, |   96                                 const gfx::Rect& image_rect, | 
|   97                                 const gfx::Rect& source_rect, |   97                                 const gfx::Rect& source_rect, | 
|   98                                 gfx::Vector2d dest_offset, |   98                                 const gfx::Vector2d& dest_offset, | 
|   99                                 ResourceFormat format); |   99                                 ResourceFormat format); | 
|  100   void UploadWithTexImageETC1(const uint8* image, const gfx::Size& size); |  100   void UploadWithTexImageETC1(const uint8* image, const gfx::Size& size); | 
|  101  |  101  | 
|  102   gpu::gles2::GLES2Interface* gl_; |  102   gpu::gles2::GLES2Interface* gl_; | 
|  103   ScopedPtrDeque<Query> pending_queries_; |  103   ScopedPtrDeque<Query> pending_queries_; | 
|  104   ScopedPtrDeque<Query> available_queries_; |  104   ScopedPtrDeque<Query> available_queries_; | 
|  105   std::multiset<double> textures_per_second_history_; |  105   std::multiset<double> textures_per_second_history_; | 
|  106   size_t num_blocking_texture_uploads_; |  106   size_t num_blocking_texture_uploads_; | 
|  107  |  107  | 
|  108   size_t sub_image_size_; |  108   size_t sub_image_size_; | 
|  109   scoped_ptr<uint8[]> sub_image_; |  109   scoped_ptr<uint8[]> sub_image_; | 
|  110  |  110  | 
|  111   size_t num_texture_uploads_since_last_flush_; |  111   size_t num_texture_uploads_since_last_flush_; | 
|  112  |  112  | 
|  113   DISALLOW_COPY_AND_ASSIGN(TextureUploader); |  113   DISALLOW_COPY_AND_ASSIGN(TextureUploader); | 
|  114 }; |  114 }; | 
|  115  |  115  | 
|  116 }  // namespace cc |  116 }  // namespace cc | 
|  117  |  117  | 
|  118 #endif  // CC_RESOURCES_TEXTURE_UPLOADER_H_ |  118 #endif  // CC_RESOURCES_TEXTURE_UPLOADER_H_ | 
| OLD | NEW |