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 #include "ppapi/proxy/compositor_layer_resource.h" | 5 #include "ppapi/proxy/compositor_layer_resource.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 data_.texture->premult_alpha = PP_ToBool(premult); | 337 data_.texture->premult_alpha = PP_ToBool(premult); |
338 return PP_OK; | 338 return PP_OK; |
339 } | 339 } |
340 return PP_ERROR_BADARGUMENT; | 340 return PP_ERROR_BADARGUMENT; |
341 } | 341 } |
342 | 342 |
343 bool CompositorLayerResource::SetType(LayerType type) { | 343 bool CompositorLayerResource::SetType(LayerType type) { |
344 if (type == TYPE_COLOR) { | 344 if (type == TYPE_COLOR) { |
345 if (data_.is_null()) | 345 if (data_.is_null()) |
346 data_.color.reset(new CompositorLayerData::ColorLayer()); | 346 data_.color.reset(new CompositorLayerData::ColorLayer()); |
347 return data_.color; | 347 return !!data_.color; |
348 } | 348 } |
349 | 349 |
350 if (type == TYPE_TEXTURE) { | 350 if (type == TYPE_TEXTURE) { |
351 if (data_.is_null()) | 351 if (data_.is_null()) |
352 data_.texture.reset(new CompositorLayerData::TextureLayer()); | 352 data_.texture.reset(new CompositorLayerData::TextureLayer()); |
353 return data_.texture; | 353 return !!data_.texture; |
354 } | 354 } |
355 | 355 |
356 if (type == TYPE_IMAGE) { | 356 if (type == TYPE_IMAGE) { |
357 if (data_.is_null()) | 357 if (data_.is_null()) |
358 data_.image.reset(new CompositorLayerData::ImageLayer()); | 358 data_.image.reset(new CompositorLayerData::ImageLayer()); |
359 return data_.image; | 359 return !!data_.image; |
360 } | 360 } |
361 | 361 |
362 // Should not be reached. | 362 // Should not be reached. |
363 DCHECK(false); | 363 DCHECK(false); |
364 return false; | 364 return false; |
365 } | 365 } |
366 | 366 |
367 int32_t CompositorLayerResource::CheckForSetTextureAndImage( | 367 int32_t CompositorLayerResource::CheckForSetTextureAndImage( |
368 LayerType type, | 368 LayerType type, |
369 const scoped_refptr<TrackedCallback>& release_callback) { | 369 const scoped_refptr<TrackedCallback>& release_callback) { |
(...skipping 12 matching lines...) Expand all Loading... |
382 | 382 |
383 // Do not allow using a block callback as a release callback. | 383 // Do not allow using a block callback as a release callback. |
384 if (release_callback->is_blocking()) | 384 if (release_callback->is_blocking()) |
385 return PP_ERROR_BADARGUMENT; | 385 return PP_ERROR_BADARGUMENT; |
386 | 386 |
387 return PP_OK; | 387 return PP_OK; |
388 } | 388 } |
389 | 389 |
390 } // namespace proxy | 390 } // namespace proxy |
391 } // namespace ppapi | 391 } // namespace ppapi |
OLD | NEW |