Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
opt: rgba -> bgra
  • Loading branch information
Kingtous committed Nov 22, 2022
commit 8224bb9f2a0b4c8053fd5da47842d64ab3eded89
8 changes: 4 additions & 4 deletions shell/platform/windows/cursor_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ static constexpr char kChannelName[] = "flutter/mousecursor";
static constexpr char kActivateSystemCursorMethod[] = "activateSystemCursor";
static constexpr char kKindKey[] = "kind";

// This method allows setting a custom cursor with rawRGBA buffer.
// This method allows setting a custom cursor with rawBGRA buffer.
static constexpr char kSetCustomCursorMethod[] = "setCustomCursor/windows";
// A list of bytes, the custom cursor's rawRGBA buffer.
// A list of bytes, the custom cursor's rawBGRA buffer.
static constexpr char kCustomCursorBufferKey[] = "buffer";
// A double, the x coordinate of the custom cursor's hotspot, starting from
// left.
Expand Down Expand Up @@ -108,7 +108,7 @@ void CursorHandler::HandleMethodCall(
HCURSOR cursor = GetCursorFromBuffer(buffer, hot_x, hot_y, width, height);
if (cursor == nullptr) {
result->Error("Argument error",
"Argument must contain valid rawRgba bitmap");
"Argument must contain valid rawBGRA bitmap");
return;
}
delegate_->SetFlutterCursor(cursor);
Expand All @@ -124,7 +124,7 @@ HCURSOR GetCursorFromBuffer(const std::vector<uint8_t>& buffer,
int width,
int height) {
HCURSOR cursor = nullptr;
// Flutter returns rawRgba, which has 8bits * 4channels.
// Flutter returns rawRGRA, which has 8bits * 4channels.
auto bitmap = CreateBitmap(width, height, 1, 32, &buffer[0]);
if (bitmap == nullptr) {
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/windows/cursor_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CursorHandler {
WindowBindingHandler* delegate_;
};

// Create a cursor from buffer and cursor info.
// Create a cursor from a rawBGRA buffer and the cursor info.
HCURSOR GetCursorFromBuffer(const std::vector<uint8_t>& buffer,
double hot_x,
double hot_y,
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/windows/cursor_handler_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace flutter {
namespace testing {
TEST(CursorHandlerTest, CreateDummyCursor) {
// create a 4x4 rawRGBA dummy cursor buffer.
// create a 4x4 rawBGRA dummy cursor buffer.
std::vector<uint8_t> buffer;
for (int i = 0; i < 4 * 4 * 4; i++) {
buffer.push_back(0);
Expand Down