Wonsik Kim | f837c93 | 2014-02-24 14:20:35 +0900 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <stdlib.h> |
| 18 | #include <stdint.h> |
| 19 | #include <sys/types.h> |
| 20 | |
| 21 | #include <utils/Errors.h> |
| 22 | #include <utils/Log.h> |
| 23 | |
| 24 | #include <ui/GraphicBuffer.h> |
| 25 | |
| 26 | #include "LayerVideoPlane.h" |
| 27 | #include "SurfaceFlinger.h" |
| 28 | #include "DisplayDevice.h" |
| 29 | #include "RenderEngine/RenderEngine.h" |
| 30 | |
| 31 | #define DEBUG_BLUE_SURFACE 1 |
| 32 | |
| 33 | namespace android { |
| 34 | // --------------------------------------------------------------------------- |
| 35 | |
| 36 | LayerVideoPlane::LayerVideoPlane(SurfaceFlinger* flinger, const sp<Client>& client, |
| 37 | const String8& name, uint32_t w, uint32_t h, uint32_t flags) |
| 38 | : Layer(flinger, client, name, w, h, flags) { |
| 39 | } |
| 40 | |
| 41 | LayerVideoPlane::~LayerVideoPlane() { |
| 42 | } |
| 43 | |
| 44 | void LayerVideoPlane::onDraw(const sp<const DisplayDevice>& hw, |
| 45 | const Region& /* clip */, bool useIdentityTransform) const |
| 46 | { |
| 47 | #if DEBUG_BLUE_SURFACE |
| 48 | Mesh mesh(Mesh::TRIANGLE_FAN, 4, 2); |
| 49 | computeGeometry(hw, mesh, useIdentityTransform); |
| 50 | RenderEngine& engine(mFlinger->getRenderEngine()); |
| 51 | engine.setupFillWithColor(0.0f, 0.0f, 1.0f, 1.0f); |
| 52 | engine.drawMesh(mesh); |
| 53 | #else |
| 54 | // TODO |
| 55 | #endif |
| 56 | } |
| 57 | |
| 58 | bool LayerVideoPlane::isVisible() const { |
| 59 | const Layer::State& s(getDrawingState()); |
| 60 | return !(s.flags & layer_state_t::eLayerHidden); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | // --------------------------------------------------------------------------- |
| 65 | |
| 66 | }; // namespace android |