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

Unified Diff: gpu/command_buffer/service/texture_definition.cc

Issue 344483006: Fix GLImageSync::GetSize() to return actual texture size (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/texture_definition.cc
diff --git a/gpu/command_buffer/service/texture_definition.cc b/gpu/command_buffer/service/texture_definition.cc
index 24382f0da39734390ccedd940d6aac2d8551afa3..3703f14b5111d9bdd2bf901bc6b629b94b71e73b 100644
--- a/gpu/command_buffer/service/texture_definition.cc
+++ b/gpu/command_buffer/service/texture_definition.cc
@@ -20,8 +20,8 @@ namespace {
class GLImageSync : public gfx::GLImage {
public:
- explicit GLImageSync(
- const scoped_refptr<NativeImageBuffer>& buffer);
+ explicit GLImageSync(const scoped_refptr<NativeImageBuffer>& buffer,
+ const gfx::Size& size);
// Implement GLImage.
virtual void Destroy() OVERRIDE;
@@ -40,12 +40,14 @@ class GLImageSync : public gfx::GLImage {
private:
scoped_refptr<NativeImageBuffer> buffer_;
+ gfx::Size size_;
DISALLOW_COPY_AND_ASSIGN(GLImageSync);
};
-GLImageSync::GLImageSync(const scoped_refptr<NativeImageBuffer>& buffer)
- : buffer_(buffer) {
+GLImageSync::GLImageSync(const scoped_refptr<NativeImageBuffer>& buffer,
+ const gfx::Size& size)
+ : buffer_(buffer), size_(size) {
if (buffer)
buffer->AddClient(this);
}
@@ -58,8 +60,7 @@ GLImageSync::~GLImageSync() {
void GLImageSync::Destroy() {}
gfx::Size GLImageSync::GetSize() {
- NOTREACHED();
- return gfx::Size();
+ return size_;
}
bool GLImageSync::BindTexImage(unsigned target) {
@@ -339,7 +340,10 @@ TextureDefinition::TextureDefinition(
DCHECK(texture->level_infos_[0][0].width);
DCHECK(texture->level_infos_[0][0].height);
- scoped_refptr<gfx::GLImage> gl_image(new GLImageSync(image_buffer_));
+ scoped_refptr<gfx::GLImage> gl_image(
+ new GLImageSync(image_buffer_,
+ gfx::Size(texture->level_infos_[0][0].width,
+ texture->level_infos_[0][0].height)));
texture->SetLevelImage(NULL, target, 0, gl_image);
// TODO: all levels
@@ -357,7 +361,6 @@ TextureDefinition::TextureDefinition(
std::vector<LevelInfo> infos;
infos.push_back(info);
level_infos_.push_back(infos);
-
}
TextureDefinition::~TextureDefinition() {
@@ -414,8 +417,15 @@ void TextureDefinition::UpdateTexture(Texture* texture) const {
info.cleared);
}
}
- if (image_buffer_)
- texture->SetLevelImage(NULL, target_, 0, new GLImageSync(image_buffer_));
+ if (image_buffer_) {
+ texture->SetLevelImage(
+ NULL,
+ target_,
+ 0,
+ new GLImageSync(
+ image_buffer_,
+ gfx::Size(level_infos_[0][0].width, level_infos_[0][0].height)));
+ }
texture->target_ = target_;
texture->SetImmutable(immutable_);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698